Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $User = "SERVER-NAME\AdminUser"
- $Password = "Password"
- $net = new-object -ComObject WScript.Network
- $net.MapNetworkDrive("X:", "\\SERVER-NAME\TestFolder", $false, $User, $Password)
- Copy-Item -Path "D:\Path\To\Copy\From" -Destination "x:\" -Recurse -Force -PassThru
- $net.RemoveNetworkDrive("x:", 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement