Remote Pre-Staging to wds

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of skl816405 skl816405 1 month ago.

  • Author
    Posts
  • #71389
    Profile photo of skl816405
    skl816405
    Participant

    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
    Profile photo of Sam Boutros
    Sam Boutros
    Participant
    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
    Profile photo of skl816405
    skl816405
    Participant

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

    have a very nice day

    best regards to you all 🙂

You must be logged in to reply to this topic.