Created
August 4, 2016 00:01
-
-
Save Dan1el42/b0bd502dc2564ee550d992141222ff62 to your computer and use it in GitHub Desktop.
A possible solution for https://powershell.org/forums/topic/copy-item-error-from-j-helmick-course/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$servers | ForEach-Object { | |
$PSDriveName = '{0}ServerRoot' -f $_ | |
New-PSDrive -Name $PSDriveName -PSProvider FileSystem -Root \\$_\C$ -Credential $creds | |
try { | |
Copy-Item -Path '.\cl21163_Groups.txt' -Destination "${PSDriveName}:\" | |
} finally { | |
Remove-PSDrive -Name $PSDriveName -Force | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment