Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Powershell Remote Pre-Staging to wds

Status
Not open for further replies.

Skl816405

Technical User
May 24, 2017
1
SE
I,m having problem in my powershell script I,m trying to remote prestage a client to my wds, i hope someone can help

this is the secript

============================================================

$Username = "WDS\administrator"
$Password = "PassWord"
$Pass = ConvertTo-SecureString $Password -asPlainText -force
$Cred = new-object System.Management.Automation.PSCredential($UserName, $pass)

$DevGuid = Get-WmiObject Win32_NetworkAdapter -Filter "netenabled = true" | Select -Expand Guid
$DevNam = Get-WmiObject -Class Win32_Bios | Select -Expand SerialNumber

Invoke-Command -ComputerName WDS -ScriptBlock { New-WdsClient -DeviceID $DevGuid -DeviceName $DevNam -BootImagePath "Boot\x64\Images\LiteTouchPE_x64.wim" } -credential $Cred

============================================================

When i run the secript i get this error message.

(Cannot validate argument on parameter 'DeviceID'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. )



First i hade this command and it worked well

=============================================================

$Username = "WDS\administrator"
$Password = "PassWord"
$Pass = ConvertTo-SecureString $Password -asPlainText -force
$Cred = new-object System.Management.Automation.PSCredential($UserName, $pass)

Invoke-Command -ComputerName WDS -ScriptBlock { New-WdsClient -DeviceID "ComputerGUID" -DeviceName "ComputerName" -BootImagePath "Boot\x64\Images\LiteTouchPE_x64.wim" } -credential $Cred

=============================================================


powershell version 5.0

Best regards to you all
 
Is it the braces in the GUID?
Try adding this.

Code:
$DevGuid = Get-WmiObject Win32_NetworkAdapter -Filter "netenabled = true" | Select -Expand Guid
[COLOR=#CC0000][b]$DevGuid = $DevGuid.Substring(1,$DevGuid.Length - 2)[/b][/color]
$DevNam = Get-WmiObject -Class Win32_Bios | Select -Expand SerialNumber





Light travels faster than sound. That's why some people appear bright until you hear them speak.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top