Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

script which list the username and computer with the applications group

$
0
0

hi guys

I need some help with a script

i would like to make a script which list ALL computers and application within an department. This script does the trick

$out = @()

Get-ADComputer -Filter "Name -like 'ATANS*'" -Properties memberOf | ForEach {

    $server = $_
    
    foreach ($group in $server.memberOf) {

        $props = @{
            'Server Name' = $server.Name
            'Group Name' = (Get-ADGroup $group).Name
        }

        $out += New-Object PsObject -Property $props

    }

}

$out | Sort-Object 'Server Name' | Export-Csv .\serverGroupMemberships.csv -NoTypeInformation

Further i like to use the computername from this csv file and to look for who is the owner of the machine.

The machine name have the syntax(SITENAME-USERNMAME-xx) 

If possible i like to have the username infomration stored within the same excel colum as the machinename

Hope someone can help me out here

Update: Is this is to difficult i could maybe use a script which can show me the spreadsheet like this




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>