5 Replies Latest reply on Aug 18, 2011 8:30 AM by daat99

    Unable to terminate KVM session using WinRM

    daat99

      Hi,

       

      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"  -remote:<ip goes here>:16992 -u:admin -p:<pass goes here>  -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"   -remote:<ip goes here>:16992 -u:admin -p:<pass goes here>   -a:Digest -encoding:utf-8

       

      I would appreciate any help you can provide on this matter.

        • 1. Re: Unable to terminate KVM session using WinRM
          Adolfo_Intel

          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.  

          1 of 1 people found this helpful
          • 2. Re: Unable to terminate KVM session using WinRM
            jake_friz

            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
            Dim flgWSFlags
            Dim strIP
            Dim strResource
            Dim strInput
            Dim strResult
            Dim strUser
            Dim strPass

             

            ' Digest User with proper AMT permissions
            strUser = "admin"
            strPass = 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://" & strIP & ":16992/wsman", flgWSFlags, objConnOpt)

             

            ' URI to WSMan Class
            strResource = "http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData"

             

            ' Input for Invoke Command
            strInput = _
            "<f:TerminateSession_INPUT xmlns:f=""" & strResource & """>" &_
            "</f:TerminateSession_INPUT>"

             

            ' Run WSMan Command
            strResult = objSession.Invoke("TerminateSession", strResource, strInput)
            wscript.echo strResult

            • 3. Re: Unable to terminate KVM session using WinRM
              daat99

              Do you know of another command line tool that is capable of sending wsman commands?

              Other GUI tools works OK but I need it in a batch file (not power shell).

              • 4. Re: Unable to terminate KVM session using WinRM
                jake_friz

                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 <filename>.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?

                1 of 1 people found this helpful
                • 5. Re: Unable to terminate KVM session using WinRM
                  daat99

                  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.

                   

                  PS

                  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