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

Securestring password

$
0
0
Powershell
$pwdloc="\\RenamePC\password.txt"[Byte[]]$key=(1..16)$pwd=Get-Content$pwdloc|ConvertTo-SecureString-Key$key$username="domain\domainadmin"$path="\\PC_Rename_New\renamepc.csv"$hash=@{}$oldName=$env:COMPUTERNAMEImport-Csv$path|foreach{$hash.add($_.DNUM,$_.NewName)}$newName=$hash.$oldname$computer=Get-WmiObjectWin32_ComputerSystem-ComputerName$oldName$computer.Rename($newName,$pwd,$Username)
ok so i need to rename a list of computer which I have in a csv. When i run the method to rename the computer it is not taking the securestring credential, and hence not renaming the PC. FYI this is in powershell 2.0. Yes I am restricted to 2.0


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>