Session.Timeout property
Sets and gets the maximum amount of time, in milliseconds, that the client application waits for Windows Remote Management to complete its operations.
This property is read/write.
Syntax
Session.Timeout As long
Property value
Time-out value, in milliseconds. When the time-out value is exceeded, a run-time error occurs.
Remarks
The time-out value can be set before each operation performed by the agent. If a time-out value is not specified, the agent sets the time-out value.
During an enumerate operation, the time-out value cannot be reset while the resource is being enumerated.
Examples
The following VBScript code example starts a Calc.exe process using the Create method of the WMI Win32_Process class. The strInputParameters parameter contains the input parameters in XML format. The script specifies a time-out for the session.
Set objWsman = CreateObject( "WSMan.Automation" )
If objWsman is Nothing Then
WScript.Echo "Failed to create WSMAN Automation object"
WScript.Quit
End If
Set objSession = objWsman.CreateSession
If objSession is Nothing Then
WScript.Echo "Failed to create WSMAN Session object"
WScript.Quit
End If
strResource = "http://schemas.microsoft.com/wbem/wsman/1/" & _
"wmi/root/cimv2/Win32_Process"
'Reset timeout to 10,000 milliseconds
objSession.Timeout = 10000
strInputParameters = "<p:Create_INPUT " & _
"xmlns:p=""http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Process"">" & _
"<p:CommandLine>" & "calc.exe" & _
"</p:CommandLine>" & _
"</p:Create_INPUT>"
strOutputParameters = objSession.Invoke( "Create", _
strResource, strInputParameters )
DisplayOutput( strOutputParameters )
'****************************************************
' Displays WinRM XML message using built-in XSL
'****************************************************
Sub DisplayOutput( strWinRMXml )
Dim xmlFile, xslFile
Set xmlFile = CreateObject( "MSXml2.DOMDocument.3.0" )
Set xslFile = CreateObject( "MSXml2.DOMDocument.3.0" )
xmlFile.LoadXml( strWinRMXml )
xslFile.Load( "WsmTxt.xsl" )
Wscript.Echo xmlFile.TransformNode( xslFile )
End Sub
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Header |
|
IDL |
|
Library |
|
DLL |
|