INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Powershell Remote Pre-Staging to wds

Powershell Remote Pre-Staging to wds

(OP)
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

RE: Powershell Remote Pre-Staging to wds

Is it the braces in the GUID?
Try adding this.

CODE -->

$DevGuid = Get-WmiObject Win32_NetworkAdapter -Filter "netenabled = true" | Select -Expand Guid
$DevGuid = $DevGuid.Substring(1,$DevGuid.Length - 2)
$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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close