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

Powershell Compare command

$
0
0

Powershell script what I create will verify to imported AD csv files and this is also working. Now the functionality I would like to see in my exported is also the old ParentContainer only cannot get the information out see the following script:

# Import new and week old .csv file and compare the differents removed
$CSV1 = './Servers moved Last Week/servers.csv'
$CSV2 = './Servers moved Last Week/servers_lstwk.csv'
$ff = Import-Csv $csv1
$sf = Import-Csv $csv2
Compare-Object -referenceobject $ff -differenceobject $sf -includeequal -Property "Name", "ParentContainer" -PassThru | Where-Object{$_.SideIndicator -eq '=>' } | 
Select-Object  "Name", "ParentContainer", "OSName", "operatingSystemServicePack", "whenCreated", "LastLogonTimestamp", "AccountIsDisabled" | Export-Csv -NoTypeInformation -Path './Servers moved Last Week/serversmoved.csv'


Viewing all articles
Browse latest Browse all 15028

Trending Articles