DAK1974
(Fresh Scripter)
2006-03-17 03:40 PM
Help running a command remotely...

Hi,

The following code returns the status of all SMS Components on the local machine. Any ideas how I modify the createobject line to run this against a remote machine?

$smsrcsappletmgr=CreateObject("CPApplet.CPAppletMgr")
$smsrcsclientcomponents=$smsrcsappletmgr.GetClientComponents
FOR EACH $smsrcsclientcomponent IN $smsrcsclientcomponents
? $smsrcsclientcomponent.DisplayName+" is "
SELECT
CASE $smsrcsclientcomponent.State=0
"INSTALLED"
CASE $smsrcsclientcomponent.State=1
"ENABLED"
CASE $smsrcsclientcomponent.State=2
"DISABLED"
CASE 1
"UNKNOWN"
ENDSELECT
NEXT

Dave


Chris S.
(MM club member)
2006-03-17 04:04 PM
Re: Help running a command remotely...

Give this a go...

Code:

$remotecomputer="remotePC"

$smsrcsappletmgr=CreateObject("CPApplet.CPAppletMgr",$remotecomputer)
$smsrcsclientcomponents=$smsrcsappletmgr.GetClientComponents

FOR EACH $smsrcsclientcomponent IN $smsrcsclientcomponents
? $smsrcsclientcomponent.DisplayName+" is "
SELECT
CASE $smsrcsclientcomponent.State=0
"INSTALLED" ?
CASE $smsrcsclientcomponent.State=1
"ENABLED" ?
CASE $smsrcsclientcomponent.State=2
"DISABLED" ?
CASE 1
"UNKNOWN" ?
ENDSELECT
NEXT



DAK1974
(Fresh Scripter)
2006-03-17 04:19 PM
Computer says no...

Hmmm... whilst this looks sensible it didn't seem to like that. I get the error "too many parameters".

Chris S.
(MM club member)
2006-03-17 05:10 PM
Re: Computer says no...

Hmm. I should have known when google only had one hit on it. I don't think that component is scriptable against a remote computer.

What are you trying to accomplish? Maybe we can come up with an alternative method.


DAK1974
(Fresh Scripter)
2006-03-17 05:18 PM
Not to worry...

How odd. I'm using this script to make sure my SMS client has properly applied my site policy by checking the component's status. To be honest this script is working fine for my current requirements. I was just looking for ways to make it better. Most of my SMS scripts use GETOBJECT SMS_CLIENT and that's easy to specify a remote computername, but thie CREATEOBJECT APPLETMGR is a bit more tricky...

Chris S.
(MM club member)
2006-03-17 06:51 PM
Re: Not to worry...

Yeah, I don't think it was designed with remote automation in mind.