Skip to content

Instantly share code, notes, and snippets.

@danaugustin
Created December 4, 2018 23:33
Show Gist options
  • Select an option

  • Save danaugustin/4bbb034db33be13497622bbbd98e51eb to your computer and use it in GitHub Desktop.

Select an option

Save danaugustin/4bbb034db33be13497622bbbd98e51eb to your computer and use it in GitHub Desktop.
WinRM Software Deployment
$credential = Get-Credential
$psdrive = @{
Name = "PSDrive"
PSProvider = "FileSystem"
Root = "\\fileserver\path"
Credential = $credential
}
$computers = Get-Content –Path "C:\deploy\pcs.txt"
foreach ($pc in $computers) {
Invoke-Command -ComputerName $pc -ScriptBlock {
New-PSDrive @using:psdrive
\\fileserver\path\deploy.bat
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment