Jump to content

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

Link to comment
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]

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...