Advertisement
Guest User

Untitled

a guest
Feb 10th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. $User = "SERVER-NAME\AdminUser"
  2. $Password = "Password"
  3.  
  4. $net = new-object -ComObject WScript.Network
  5. $net.MapNetworkDrive("X:", "\\SERVER-NAME\TestFolder", $false, $User, $Password)
  6. Copy-Item -Path "D:\Path\To\Copy\From" -Destination "x:\" -Recurse -Force -PassThru
  7. $net.RemoveNetworkDrive("x:", 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement