Login | |
|
 |
RE: Need some help with services script - 12/5/2006 12:21:04 AM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
The best approach for debugging WMI scripts like this is to test your query in WBEMTest. You'll need to strip out the VBScript code in it first. Once you have the query working, then paste it back into your script. If there is still a problem, at least you know it isn't the WMI query which is a big step. You might also have to check if the service is disabled because you'll get an error if you try to start it. If after all of that you still have problems, tell us what error you are getting.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
 |
RE: Need some help with services script - 12/5/2006 4:30:31 AM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
You can't have a subroutine like that in the middle of your script. Get rid of the SUB and End Sub lines, and even though it won't be the prettiest code at the ball I think it should work.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
 |
RE: Need some help with services script - 12/5/2006 5:06:52 AM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
Except in this case, his subroutine needed a runtime parameter which he was never calling. In this case I don't think he really needs the sub at all.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
 |
RE: Need some help with services script - 12/5/2006 5:09:58 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
I agree that the sub appears useless in the posted code. I just wanted to make sure that it was clear that there is no right or wrong place to put procedures as far as the compiler is concerned. There are simply guidelines to make things easier to read.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Need some help with services script - 12/6/2006 1:16:50 AM
|
|
 |
|
| |
mbouchard
Posts: 1922
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
quote:
ORIGINAL: buffi mbouchard You are a genious thanks alot. Cheers bufff Why, yes, yes I am . You are welcome.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
|
|