'private const L_HelpEnum_013_0_Message = "Example: List all auto start services that are stopped:"
'private const X_HelpEnum_014_0_Message = " winrm enum wmicimv2/* -filter:""select * from win32_service where StartMode=\""Auto\"" and State = \""Stopped\"" """
'private const L_HelpEnum_015_0_Message = ""
private const L_HelpEnum_016_0_Message = "Example: List all shell instances on a machine:"
ASSERTBOOL (LCase(optDic.Argument(NPARA_AUTH)) = VAL_CERT), "The " & NPARA_CERT & " option is only valid when the authentication mechanism is " & VAL_CERT
end if
'-auth might be missing, in which case we assume -a:Certificate
sessionFlags = sessionFlags OR wsman.SessionFlagUseClientCertificate
end if
if optDic.ArgumentExists(NPARA_NOCACHK) then
'C API will ensure this is only used w/ https
sessionFlags = sessionFlags OR wsman.SessionFlagSkipCACheck
end if
if optDic.ArgumentExists(NPARA_NOCNCHK) then
'C API will ensure this is only used w/ https
sessionFlags = sessionFlags OR wsman.SessionFlagSkipCNCheck
end if
if optDic.ArgumentExists(NPARA_SPNPORT) then
'this is only valid if -auth is not specified or if -auth:Negotiate or -auth:Kerberos is specified
if optDic.ArgumentExists(NPARA_AUTH) then
ASSERTBOOL (LCase(optDic.Argument(NPARA_AUTH)) = VAL_NEGOTIATE OR LCase(optDic.Argument(NPARA_AUTH)) = VAL_KERBEROS), "The " & NPARA_SPNPORT & " option is only valid when the authentication mechanism is " & VAL_NEGOTIATE & " or " & VAL_KERBEROS
end if
sessionFlags = sessionFlags OR wsman.SessionFlagEnableSPNServerPort
end if
on error resume next
set session = wsman.CreateSession(conStr, sessionFlags, conOpt)
ASSERTERR wsman, formatOption
on error goto 0
if optDic.ArgumentExists(NPARA_TIMEOUT) then
ASSERTNAL(NPARA_TIMEOUT)
tout = optDic.Argument(NPARA_TIMEOUT)
ASSERTBOOL IsNumeric(tout), "Numeric value for -timeout option is expected"
session.Timeout = optDic.Argument(NPARA_TIMEOUT)
end if
set CreateSession = session
end function
private sub ASSERTERR(obj, formatOption)
dim errNo
dim errDesc
dim responseStr
dim formattedStr
if Err.Number <> 0 then
errNo = Err.Number
errDesc = Err.Description
responseStr = obj.Error
If Reformat(responseStr,formattedStr,formatOption) Then