Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dan1el42/b0bd502dc2564ee550d992141222ff62 to your computer and use it in GitHub Desktop.
Save Dan1el42/b0bd502dc2564ee550d992141222ff62 to your computer and use it in GitHub Desktop.
$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