Can we use variables?
we're trying to create a script for use on new installations or reinstallations. One of the lines will be to rename a device (Rename-Computer -ComputerName "OldName" -NewName "NewName" -DomainCredential Domain01\Admin01 -Force). But is there a way to work with variables so we can define this seperately for the devices?
Also, we already tried the command directly in PDQDeploy, but we don't get a window asking for the credentials. When we use it directly via powershell is does ask for it. Are we doing something wrong or maybe forgetting something?
You could do something like the following for Variables.
$Computer = Get-WmiObject -Class:Win32_ComputerSystemProduct | Select-Object -Property IdentifyingNumber
$NewName = "Prefix$($Computer.IdentifyingNumber)"
Computer -ComputerName "OldName" -NewName $NewName -DomainCredential Domain01\Admin01 -Force
This would assign a name based the computers SN. It ultimately depends on how you are naming your computers. Yes it can be done, but the question is how complicated it will be. I believe you can also reference PDQ variables in Powershell scripts run from PDQ, but I have not done this myself.
Since the script requires user interaction, it needs to be deployed as interactive or logged on user (I forget which).
OK, than you for the info. We'll play around already with this.
If someone else has suggestions or experience with it, please shoot.
Please sign in to leave a comment.