I'm attempting to terminate an active KVM session using the following WinRM command:
winrm invoke TerminateSession http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData" -remote::16992 -u:admin -p: -a:Digest -encoding:utf-8
After I execute the command I'm getting SchemaValidationError telling me that I need to change the XML.
Please note that when I execute the get command with the same parameters it works fine:
winrm g http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData" -remote::16992 -u:admin -p: -a:Digest -encoding:utf-8
I would appreciate any help you can provide on this matter.
It could be a problem with the XML profile created for the AMT configuration in the computer that is been accessed remotely, but it could be a problem with the Windows Remote Management also. You can try a different management console tool to see if the problem persists.
Well, you can run that vbccript above from the command line. It should work on any XP, Vista, Win7, etc system without the need to add anything (besides WinRM of course). Copy/paste it, adjust the variables, save it with .vbs extension, and then run it like this:
cscript /nologo .vbs
With a little editing you can make it take the variables as input parameters as well. You could also use a vbscript compiling tool and turn it into a .exe.
I'm not familiar with any other command line WSMan tools. I've heard of openwsman, but have very little experience with it so I'm not sure it could acomplish this goal. Another option may be to format the WSMan XML manually and then use CURL to send it to AMT. I've done this for other WSMan commands, but it's quite challenging. If I were doing this project, I'd use the vbscript method above unless I absolutly could not use vbscript from some reason.
BTW - Now I'm curious, what GUI WSMan tool(s) are you using?
The script works great and it helped me create a batch file that creates the input xml file which I use as the winrm input parameter as well.
Thanks a lot for your help.
The GUI tool I use is an in-house tool and even google doesn't know about it so its name won't be very helpful
I've just tried your command, and a few variations, and am getting the same results as you. I don't know why. However, I did get it to work with a vbScript. Try this and let me know if it works and allows you to acomplish your goal:
Dim objWsman : Set objWsman = nothing
Dim objSession : Set objSession = nothing
Dim objConnOpt : Set objConnOpt = nothing
' Digest User with proper AMT permissions
strUser = "admin"
strPass = mailto:P@ssw0rd P@ssw0rd
' IP of AMT
strIP = "192.168.1.100"
' Setup WSMan
Set objWsman = CreateObject("WSMan.Automation")
set objConnOpt = objWSMan.CreateConnectionOptions
objConnOpt.Username = strUser
objConnOpt.Password = strPass
flgWSFlags = objWSMan.SessionFlagUTF8 Or objWSman.SessionFlagUseDigest Or objWSMan.SessionFlagCredUsernamePassword
' Setup WSMan Session
Set objSession = objWsman.CreateSession("http:// http://" & strIP & ":16992/wsman", flgWSFlags, objConnOpt)
' URI to WSMan Class
strResource = "http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData"
' Input for Invoke Command
strInput = _
' Run WSMan Command
strResult = objSession.Invoke("TerminateSession", strResource, strInput)