15 lines
636 B
PowerShell
15 lines
636 B
PowerShell
# PowerShell: map the remote share, copy the folder, then clean up
|
|
$remote = '\\192.168.1.159\shared-auction-data'
|
|
$local = 'C:\mnt\okcomputer\output\models'
|
|
|
|
# (1) create/verify the PSDrive (prompts for password if needed)
|
|
if (-not (Get-PSDrive -Name Z -ErrorAction SilentlyContinue)) {
|
|
$cred = Get-Credential -UserName 'tour' -Message 'SMB password for tour@192.168.1.159'
|
|
New-PSDrive -Name Z -PSProvider FileSystem -Root $remote -Credential $cred -Persist | Out-Null
|
|
}
|
|
|
|
# (2) copy the local folder into the share
|
|
Copy-Item -Path $local -Destination 'Z:\' -Recurse -Force
|
|
|
|
# (3) optional cleanup
|
|
Remove-PSDrive -Name Z -Force |