awheelhouse
(Fresh Scripter)
2005-06-10 11:51 AM
Service stop/start/query - n WMI

Is there a function that works with services without the remote computer having WMI installed? I've tried searching, but the internet connection at work is very poorly at the moment, and search results take ages to appear, and I often lose the connection.

Can someone point me in the right direction?

thanks


Co
(MM club member)
2005-06-10 12:34 PM
Re: Service stop/start/query - n WMI

Schedule a script on the remote pc in which you use something like net stop , net start or kill.exe

Co
(MM club member)
2005-06-10 12:41 PM
Re: Service stop/start/query - n WMI

Oh and you can use the ScheduleTask() UDF to schedule the task on the remote pc...

Les
(KiX Master)
2005-06-10 02:51 PM
Re: Service stop/start/query - n WMI

And what is wrong with XNet?

Co
(MM club member)
2005-06-10 03:01 PM
Re: Service stop/start/query - n WMI

Nothing... It just didn't came up to me.

Sealeopard
(KiX Master)
2005-06-11 05:09 AM
Re: Service stop/start/query - n WMI

See the UDF Mirror for a one-stop list of UDFs. What exactly do you need to accomplish?

awheelhouse
(Fresh Scripter)
2005-06-13 11:47 AM
Re: Service stop/start/query - n WMI

sealeopard,

I need to stop 4 services, this is the original batch file code:-

sc \\%1 stop "AlertManager"
sc \\%1 stop "McAfeeFramework"
sc \\%1 stop "McTaskManager"
sc \\%1 stop "MCSHIELD"

and then make some changes to reg keys and restart the services

I'm doing this at the moment:-

Run 'c:\software\kix\sc.exe \\'+$Computer +' stop "AlertManager"'
Run 'c:\software\kix\sc.exe \\'+$Computer +' stop "McAfeeFramework"'
Run 'c:\software\kix\sc.exe \\'+$Computer +' stop "McTaskManager"'
Run 'c:\software\kix\sc.exe \\'+$Computer +' stop "MCSHIELD"'

But it would be neater to do it without using sc.exe

thanks


Chris S.
(MM club member)
2005-06-13 01:42 PM
Re: Service stop/start/query - n WMI

Since services are not handled directly by KiX it becomes a matter of preference. Use whatever works best for you, be it SC, XNET, WMI, or ADSI. Whatever method you choose, won't fix your internet connection issues while running the script remotely.

awheelhouse
(Fresh Scripter)
2005-06-13 02:18 PM
Re: Service stop/start/query - n WMI

Chris,

My internet issues were just related to my own internet access, not running the scripts. I was having problems on friday using the forum. I'm ok using SC, just wanted to know if there was a kix function that was neater that didn't use WMI and I couldn't search for it.

thanks

thanks


Les
(KiX Master)
2005-06-13 02:23 PM
Re: Service stop/start/query - n WMI

Yes, it is called XNET and ships with KiX.

Chris S.
(MM club member)
2005-06-13 02:29 PM
Re: Service stop/start/query - n WMI

Ah, well I have to agree with Les and the others who have suggested XNET then. XNET is an excellent utility for querying and controlling services both locally and remotely. Use it in conjunction with one of the pipe functions (I suggest WSHPipe()) to retrieve the results of your status queries.