Jon Brelie
asked on
Need help with out-file addition to powershell script
I'm jumping in at the last minute to migrate some mailboxes off of an exchange server to another online host. I was given the following script to facilitate the mailbox transfers, but I would like to add some logging so that I can check on progress and/or modify the input file if it needs to be restarted for any reason.
Basically I just need to know where to put the 'out-file' command in this script:
That way I can just keep an eye on the output and modify the input file to remove completed users if the task needs to be restarted.
Thanks!
Basically I just need to know where to put the 'out-file' command in this script:
$users = Import-Csv -Path "users.csv"
If (!$scred) {$scred = Get-Credential "SOURCE CREDENTIALS"}
If (!$tcred) {$tcred = Get-Credential "TARGET CREDENTIALS"}
$users | ForEach-Object {
$SourceIdentity = $_.Identity
Start-Transcript -Path "$SourceIdentity.txt" -Append
Move-XsExchangeMailboxToExchangeOnline –SourceIdentity $SourceIdentity -SourceCredential $scred -
AllowUnsecureConnection -GlobalCatalog "GLOBAL CATALOG SERVER" -TargetCredential $tcred -
Verbose
Stop-Transcript
}
That way I can just keep an eye on the output and modify the input file to remove completed users if the task needs to be restarted.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The script didn't work, but the logging piece did exactly what you said it would.
Thanks!