Sign in to follow this  
Followers 0
fly

How can I set something with WMI?

3 posts in this topic

Thanks to the Scriptomatic, I can see how to display information. However, I'm a little foggy on how to actually set information. I have the following code:

Set objLocator = WScript.CreateObject("WbemScripting.SWbemLocator")
Set objServices = objLocator.ConnectServer(".", "root/CIMV2")
strWMIObjectID = "Win32_Service.Name=""Messenger"""   'Be excact here!
Set objService = objServices.Get(strWMIObjectID)
objService.ChangeStartMode "Manual"
objService.StartService

But am unsure how to convert this. I read through a couple of pages of searches for the term 'WMI', but wasn't able to figure anything out. So here I am...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$objLocator = ObjCreate("WbemScripting.SWbemLocator")
$objServices = $objLocator.ConnectServer(".", "root/CIMV2")
$strWMIObjectID = "Win32_Service.Name=""Messenger"""      ;Be excact here!
$objService = $objServices.Get($strWMIObjectID)
$objService.ChangeStartMode ("Manual")
$objService.StartService()

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

ahhh! Now THAT makes sense.

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