0

Can you please help me where to add credentials (all windows servers have same credentials) in this script to puch scripts

Point the script to a text file with a list of computers

$Computers = "C:\File Copy\Source Server\ComputerList.txt"

Sets the variable for the source file location

$Source = "C:\File Copy\prod.csv"

Sets the variable for the file destination

$Destination = "File copy\Servers"  

Get the content of $computers and copy Source to Destination

Get-Content $Computers | ForEach-Object {Copy-Item $Source -Destination (Join-Path "\\$_\c`$\" $Destination)

Apologies in advance i am not an expert on powershell so dont know much can you explain a bit

  • Possible duplicate of [copy-item With Alternate Credentials](https://stackoverflow.com/questions/612015/copy-item-with-alternate-credentials) – Robert Dyjas Jun 20 '18 at 07:18
  • Sorry robdy didnt understood. i am not an expert in powershell but have to complete this can i store credentials in code as all servers have same credentials. – ankit singh Jun 20 '18 at 07:23
  • This can be also found on SO, for example [here](https://stackoverflow.com/questions/6239647/using-powershell-credentials-without-being-prompted-for-a-password). I'd suggest you to search existing questions first and then ask a question if more specific help is needed – Robert Dyjas Jun 20 '18 at 07:35

0 Answers0