Jump to content
Sign in to follow this  

How can I set something with WMI?

Recommended Posts


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"

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

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

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

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.