Hi,
I would like to import AD (active directory) into a text file. Once that is done, i want to use a script to check for local admin. I'm very new to scripting and could use some help. Here is what i have so far:
Get-ADComputer -Filter *All computer objects:
Get-ADComputer -Filter *
###################################
Save ADComputer name to file. Saveing to a excel file would be great. But a txt will work as well.
###################################
$server = Read-Host "What is the server name?"
$computer = [ADSI](”WinNT://” + $server + “,computer”)
$Group = $computer.psbase.children.find(”Administrators”)
$members = ($Group.psbase.invoke(”Members”) | %{$_.GetType().InvokeMember(”Adspath”, ‘GetProperty’, $null, $_, $null)}) -replace ('WinNT://DOMAIN/' + $server + '/'), '' -replace ('WinNT://DOMAIN/', 'DOMAIN\') -replace ('WinNT://', '')
$members
###################################
Save scanned AD Computer and user to file. Saveing to a excel file would be great. But a txt will work as well.
###################################