Powershell Remote Pre-Staging to wds

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Skl816405
Posts: 1
Last visit: Wed May 24, 2017 2:45 am

Powershell Remote Pre-Staging to wds

Post by Skl816405 »

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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Powershell Remote Pre-Staging to wds

Post by jvierra »

HELP, Invoke-Command -Full

Read all and pay attention to how to pass arguments.
This topic is 6 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked