Nana Hemaa
asked on
Poweshell file to remote server
I am looking into a PowerShell script to achieve this
Copy a file from a local server path: c:\PurchaseInfo\PurchaseDe tails.txt to a remote server \\22.22.22.22\CustomerFold er
I have to log into the remote server \\22.22.22.22\CustomerFold er before I can copy the file each time. I want to embed the login credentials in a script to copy the file daily @ 10.00PM to the remote server. The username for the server is "Testuser" and password is 'TestPassword"
. Thx
Copy a file from a local server path: c:\PurchaseInfo\PurchaseDe
I have to log into the remote server \\22.22.22.22\CustomerFold
. Thx
ASKER
ok thanks. What can I use to schedule this to run on daily basis?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
^^ Exactly what he said
ASKER
Qlemo.
Thx.. if the file is already there, I want to rename it to PurchaseDetails10192016.tx t before I write the new file PurchaseDetails.txt again
Thx.. if the file is already there, I want to rename it to PurchaseDetails10192016.tx
You meant to rename with the current date?
ASKER
yes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks one last thing.. after I copy the file I want to delete this file PurchaseDetails.txt from c:\PurchaseInfo\PurchaseDe tails.txt
I wouldn't do that. Move the file instead - replace copy by move, and it is an atomic operation removing the file only if it has been copied successfully over.
ASKER
Thanks. That makes more sense
Open in new window
The same code works in PowerShell.