You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may or may not work as the version is just a string here and not a Version object. It can technically be done to create the required type but it's quite complex.
The newer psrp namespace (which is part of the 1.0.0b1 release) makes things a bit easier than before to do what you want.
importpsrpimportpsrpcore.typeswsman_conn=psrp.WSManInfo("hostname", ...)
app_args= {
"PSVersionTable": {
"WSManStackVersion": psrpcore.types.PSVersion("2.0"),
... # Whatever else you need to define.
}
}
withpsrp.SyncRunspacePool(wsman_conn, application_arguments=app_args) asrp:
ps=psrp.SyncPowerShell(rp)
ps.add_script("$PSVersionTable")
output=ps.invoke()
print(output)
How to configure pypsrp for settings like WSManStackVersion in PowerShell, for example, the following configuration?
$secureString = ConvertTo-SecureString -String "Pwd" -AsPlainText -Force $UserCredential = New-Object System.Management.Automation.PSCredential -ArgumentList "lab\john", $secureString $version = New-Object -TypeName System.Version -ArgumentList "2.0" $mytable = $PSversionTable $mytable["WSManStackVersion"] = $version $sessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -ApplicationArguments @{PSversionTable=$mytable}
The text was updated successfully, but these errors were encountered: