Page 1 of 1 1
Topic Options
#159356 - 2006-03-17 03:40 PM Help running a command remotely...
DAK1974 Offline
Fresh Scripter

Registered: 2003-07-28
Posts: 19
Loc: Scotland
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

Top
#159357 - 2006-03-17 04:04 PM Re: Help running a command remotely...
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
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


Top
#159358 - 2006-03-17 04:19 PM Computer says no...
DAK1974 Offline
Fresh Scripter

Registered: 2003-07-28
Posts: 19
Loc: Scotland
Hmmm... whilst this looks sensible it didn't seem to like that. I get the error "too many parameters".
Top
#159359 - 2006-03-17 05:10 PM Re: Computer says no...
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
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.

Top
#159360 - 2006-03-17 05:18 PM Not to worry...
DAK1974 Offline
Fresh Scripter

Registered: 2003-07-28
Posts: 19
Loc: Scotland
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...
Top
#159361 - 2006-03-17 06:51 PM Re: Not to worry...
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Yeah, I don't think it was designed with remote automation in mind.
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.047 seconds in which 0.019 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org