• Profile picture of Stephen Valdinger

    Stephen Valdinger replied to the topic PowerShell remoting in the forum General PowerShell Q&A 1 month ago

    We could shorten this code a bit, and cast directly as well:

    #Get it like below

    $Output = Invoke-Command -Session $Session -ScriptBlock {

    $Properties = [pscustomobject]@{
    Something      = (Get-Something -SomeParam SomeValue)
    SomeOtherthing = (Get-SomeOtherthing -SomeOtherParam SomeOtherValue)
    }

    }

    #Consume it lke be…[Read more]