Hi,
I am starting a Windows 7 migration and will be moving computers to a migration OU prior to the Windows 7 installation.
I have written the following script but my export to .csv is only putting the last liine from the Move-QADObject command.
I am getting the iformation i need in the .csv but only for the last computer moved and not all devices.
Any ideas please.
============Script Start ==============
$csvpath = "\\llw-coh-cm-00\Source\Apps\PowerShell\Migration logs\moved desktop $CurrentDate.csv"
$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('MM-dd-yyyy_hh-mm-ss')
$DesktopOU = "OU=Desktops,OU=Win7 Migration,OU=Powys,DC=*******,DC=*******" # Destination of the computers in Active Directory after migration.
cls
# csv file path.
$csv = Import-Csv \\llw-coh-cm-00\Source\Apps\PowerShell\Migration CSV's\desktop migration.csv #.csv path of machines to be migrated tonight.
# Move Desktops
foreach($desktop in $csv){
Get-QADComputer -Identity $desktop.desktop | Where-Object {$desktop.desktop -eq $_.name} | Move-QADObject -To $DesktopOU | Export-Csv $csvpath
}
=============Script End ===================