Powershell Remote Pre-Staging to wds

Home Forums Scripting PowerShell Powershell Remote Pre-Staging to wds

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    Skl816405
    Member
    #167031

    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 = “WDSadministrator”
    $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 “Bootx64ImagesLiteTouchPE_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 = “WDSadministrator”
    $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 “Bootx64ImagesLiteTouchPE_x64.wim” } -credential $Cred

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

    powershell version 5.0

    Best regards to you all

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.