Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Rename-Computer Script Errors but works

$
0
0

Hi- Working on this script:

Text
PS C:\Windows\system32 $a = Import-Csv c:\users\TheDude\desktop\rename.csv -Header OldName, NewName Foreach ( $Server in $a ) {Rename-Computer -ComputerName $Server.OldName -NewName $Server.NewName -DomainCredential Domain\TheDude -Force} 

[Prompt for password]

Followed by this error:


Rename-Computer : Computer name OldName cannot be resolved with the exception: No such host is known.
At line:2 char:28
+ Foreach ( $Server in $a ) {Rename-Computer -ComputerName $Server.OldName -NewNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (OldName:String) [Rename-Computer], InvalidOperationException
+ FullyQualifiedErrorId : AddressResolutionException,Microsoft.PowerShell.Commands.RenameComputerCommand

[Prompt for password again]

Followed...


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images