Very few people know or use the new features of Windows 2003, like for instance the WinRM objects.
In short : WinRM is a standard SOAP based firewall friendly protocol that allows hardware and operating systems from different vendors to interoperate. The main goal of this standard is to make management devices and systems easier in a heterogeneous systems.WinRM ( windows remote management) is the Microsoft implementation of WS-Management protocol built in the operating system. WinRM first shipped in Windows Server 2003 R2 and enhanced in Windows Vista. WS-Management is a DMTF standard
When you are interested in using it. Your XP / Vista and Server should be configured accordingly.
For more information look here WinRM getting started
I think Vista is preconfigured having all COM objects available. But for XP you need download and install the addons.
Download WinRM
This is how the syntax works.
AutoIt
$objWsman = ObjCreate("Wsman.Automation") $objSession = $objWsman.CreateSession() $strResource = "http://schemas.microsoft.com/wbem/wsman/1/" _ & "wmi/root/cimv2/Win32_Service?Name=Winmgmt" $strResponse = $objSession.Get($strResource) ; ConsoleWrite($strResponse & @LF); Or use XML Transform DisplayOutput($strResponse) Func DisplayOutput($strWinRMXml) $xmlFile = ObjCreate("MSXml2.DOMdocument.3.0") $xslFile = ObjCreate("MSXml2.DOMdocument.3.0") $xmlFile.LoadXml($strWinRMXml) $xslFile.Load("WsmTxt.xsl") ConsoleWrite ($xmlFile.TransformNode($xslFile)) EndFunc ; --------------------------------------------------------------- $Wsman = ObjCreate("Wsman.Automation") $xmlFile = ObjCreate( "MSxml.DOMDocument") $xslFile = ObjCreate( "MSXml.DOMDocument" ) $Session = $Wsman.CreateSession $Response = $Session.Get("http://schemas.microsoft.com/wbem/wsman/" _ & "1/wmi/root/cimv2/Win32_Service?Name=Spooler") $xmlFile.LoadXml($Response) ;$xmlFile.Save( "c:\RawOutput.xml") $xslFile.Load( "WsmTxt.xsl" ) ConsoleWrite($xmlFile.TransformNode( $xslFile ) & @LF)oÝ÷ Øíz¸§²Ö¥)àjw¢wâê⨹Ƨv ç$ºÈ§Øb²Ç+ZºÚ"µÍÈ[]X[^HÜ[ÌÍÛÓ^QÜHØ][ ][ÝÐ]]Ò]Ü][ÝË ][ÝÓ^Q[É][ÝÊBÌÍÛØÜÛX[HØÜX]J ][ÝÕÜÛX[]]ÛX][Û][ÝÊBÌÍÛØÙÜÚ[ÛH ÌÍÛØÜÛX[ÜX]TÙÜÚ[Û ][ÝÛØØ[ÜÝ ][ÝË ÌÍÛØÜÛX[ÙÜÚ[ÛYÕÙSÐ]][XØ][Û NÈ ÌÍÛØÜÛX[ÙÜÚ[ÛYÕÙSÐ]][XØ][ÛBÛÛÛÛUÜ]J ÌÍÛØÙÜÚ[ÛY[YH [ÈHËKKKKKKKKKKKKKKKKKKKKKKKKKKKKKHÈÈHÓÓHÜ[KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKB[È^Q[Ê BIÌÍÒ^[XZ^ ÌÍÛÓ^QÜ[X BSÙØÞ ][ÝÐÓÓHÜÝ ][ÝË ][ÝÕÙH[ÙYHÓÓHÜ ÌÌÎÉ][ÝÈ [ÈÔ [ÈÔ [ÈÂBBI][ÝÙØÜ[ÛÎ ][ÝÈ [ÈP [È ÌÍÛÓ^QÜØÜ[Û [ÈÔ [ÈÂBBI][ÝÙÚ[ØÜ[Û][ÝÈ [ÈP [È ÌÍÛÓ^QÜÚ[ØÜ[Û [ÈÔ [ÈÂBBI][ÝÙ[XÎ ][ÝÈ [ÈP [È ÌÍÒ^[X [ÈÔ [ÈÂBBI][ÝÙÝÜÎ ][ÝÈ [ÈP [È ÌÍÛÓ^QÜÝÜ [ÈÔ [ÈÂBBI][ÝÙØÜ[HÎ ][ÝÈ [ÈP [È ÌÍÛÓ^QÜØÜ[H [ÈÔ [ÈÂBBI][ÝÙÛÝÙHÎ ][ÝÈ [ÈP [È ÌÍÛÓ^QÜÛÝÙH [ÈÔ [ÈÂBBI][ÝÙ[[HÎ ][ÝÈ [ÈP [È ÌÍÛÓ^QÜ[[H [ÈÔ [ÈÂBBI][ÝÙ[ÛÛ^Î ][ÝÈ [ÈP [È ÌÍÛÓ^QÜ[ÛÛ^ÂBBJBTÙ]ÜJHÈÈÚXÚÈÜYÈ[Ý[Û]Â[[
Enjoy !!
regards
ptrex
Edited by ptrex, 28 September 2008 - 06:04 PM.





