Sign in to follow this  
Followers 0
ptrex

WinRM - Windows remote management

3 posts in this topic

#1 ·  Posted (edited)

WinRM - Windows remote management

Very few people know or use the new features of Windows 2003, like for instance the WinRM objects.

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

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.

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.

$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

Share this post


Link to post
Share on other sites



excellent !

i've tried WinRM when it becomes available for WinXP / Win2K3

it's really powerful because it can have more the one listener, each doing something.

the best thing is the abaility to control all servers from one console.

I'll try to test your script but i've stopped using WinRM because of it's performance ... really poor ... like powershell.


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0