Remote Pre-Staging to wds

Welcome Forums General PowerShell Q&A Remote Pre-Staging to wds

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year, 6 months ago.

  • Author
    Posts
  • #71389

    Participant
    Points: 0
    Rank: Member

    Powershell Remote Pre-Staging to wds

    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

  • #71401

    Participant
    Points: 60
    Rank: Member
    Invoke-Command -ComputerName WDS -ScriptBlock { New-WdsClient -DeviceID $Using:DevGuid -DeviceName $Using:DevNam -BootImagePath "Boot\x64\Images\LiteTouchPE_x64.wim" } -credential $Cred
    

    and the BootImagePath must be full path not relative.

  • #71407

    Participant
    Points: 0
    Rank: Member

    Thank you very much (Sam Boutros) you are the best, it worked.

    have a very nice day

    best regards to you all 🙂

The topic ‘Remote Pre-Staging to wds’ is closed to new replies.