0

I want to get list of Images from a WDS Server (Windows Deployment Services) remotely.

I'm using the PowerShell command Get-WdsInstallImage and it needs the highest privileges.

I'm tried the below commands, but they don't work:

Invoke-Command -ComputerName "<computer name>" -Authentication Kerberos -Credential $(Get-Credential) -ScriptBlock {Get-WdsInstallImage}

Invoke-Command -ComputerName "<computer name>" -ScriptBlock {Start-Process PowerShell.exe Get-WdsInstallImage -verb runAs}
mino
  • 125
  • 2
  • 11
  • Maybe using the `-CimSession` works better for you: _Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer._ `$mySession = New-CimSession -ComputerName wdsname -Credential $(Get-Credential) -Authentication Kerberos; Get-WdsInstallImage -CimSession $mySession` – Theo Sep 03 '18 at 09:16
  • `Get-WdsInstallImage' is not recognized as the name of a cmdlet` , probably because i don't have WDS role on myhost and i don't wan't do that. – mino Sep 03 '18 at 09:41
  • You made a typo in the first command: `-ceredential` should be `-Credential`. – Theo Sep 03 '18 at 09:46
  • ok, corrected , but in my code it was good – mino Sep 03 '18 at 09:53

1 Answers1

0

Try this:

$w=Get-WmiObject -ComputerName "<target system>" -Namespace "root\CIMV2" -Class "MSFT_WdsBootImage" -EnableAllPrivileges -List
$x=$w.Get()
$x.cmdletOutput

$y=Get-WmiObject -ComputerName "<target system>" -Namespace "root\CIMV2" -Class "MSFT_WdsInstallImage" -EnableAllPrivileges -List
$z=$y.Get()
$z.cmdletOutput

Don't forget to use -Credentials if necessary.