title: Convert local PowerShell commands to Cim-Instance for remote administraton
body: <p>The following PowerShell code works locally but I have not been able to convert all of it to use CIM commands.  I have been unable to convert the first three queries to CIM.  The reason I need to use CIM is because that is how my network currently allows for PowerShell remote access.  The test computer has the latest SCCM Client installed.  </p>
  
  <pre><code># Check all locations that would contain a pending reboot flag
  $RebootPending = $false
  $RebootPending = $RebootPending -or ([wmiclass]'ROOT\ccm\ClientSDK:CCM_ClientUtilities').DetermineIfRebootPending().RebootPending
  $RebootPending = $RebootPending -or ([wmiclass]'ROOT\ccm\ClientSDK:CCM_ClientUtilities').DetermineIfRebootPending().IsHardRebootPending
  $RebootPending = $RebootPending -or (@(((Get-ItemProperty("HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager")).$("PendingFileRenameOperations")) |
        Where-Object { $_ }
    ).length -ne 0)
  $RebootPending = $RebootPending -or (
    @(Get-WmiObject -Query "SELECT * FROM CCM_SoftwareUpdate" -Namespace "ROOT\ccm\ClientSDK" |
        Where-Object {
        $_.EvaluationState -eq 8 -or # patch pending soft reboot
        $_.EvaluationState -eq 9 -or # patch pending hard reboot
        $_.EvaluationState -eq 10 } # reboot needed before installing patch
    ).length -ne 0)
  </code></pre>
  
  <p>I have managed to convert the last query to Cim but I cannot seem to determine how to convert the other three queries to Cim</p>
  
  <p>Converted Query:</p>
  
  <pre><code>$RebootPending = $RebootPending -or (
    @(Get-CimInstance -CimSession $($Computer.CimSession) -Namespace 'ROOT\ccm\ClientSDK' -Query "SELECT * FROM CCM_SoftwareUpdate" |
        Where-Object {
        $_.EvaluationState -eq 8 -or # patch pending soft reboot
        $_.EvaluationState -eq 9 -or # patch pending hard reboot
        $_.EvaluationState -eq 10 } # reboot needed before installing patch
    ).length -ne 0
  )
  </code></pre>