Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I deploy a script via SMS

Status
Not open for further replies.

fargo

Programmer
Nov 9, 2000
63
GB
Hi

I am pretty new to scripting and need a couple of pointers on sending out a script via SMS.
There are many reusable scripts submitted to various forums on the web, but how would you actually deploy one.
EG. where do you put it? is it a 'program'?.........

Any help appreciated
 
Well, there are a couple of ways to run scripts via SMS.

I've actually seen folks run one line shell scripts from the command line.

As for larger scripts VB, java, etc, it's best to download and execute the script.

The name of the script should be included in the commandline

E'g "C:\Temp\App_name.vbs" where the script is downloaded to a directory on the local machine and executed when the commandline is parsed simply calling the script name.

Treat the script as a package and if it's small run it from the DP and the CmdLine should hold the script name where the advertisement is set to run from DP
I hope this helps...
 
When I run vbscripts, I run them directly from the DP. I will create a source folder and put the script in there. Specify the source directory in the package properties and distribute it to my DPs. Then in the program I will specify wscript.exe scriptname.vbs in the command line. Some people might have .vbs assocated for another program so its important to specify wscript.exe or cscript.exe.

Any one line commands I have done what Count430 has done. I would create a program and specify the entire command as the command line. For example "net localgroup administrators domain\group /ADD
 

That is the 'kickstart' I needed, thanks a lot
 
When I deploy a script I create the package as per normal.

Copy WScript or equivalent into the same folder on the DP as the package that you are creating, and on the program command line just type WScript (then name of script file, i.e. test.vbs):

WScript test.vbs

Works a treat for me!!
 
Still having an issue here.
I have followed advice and created a package for my test script.
The script is here and I have called it DeleteIcons.vbs
I have copied the both script and cscript.exe to my source directory on my SMS server and made this the Data Source in the Package Properties and Access is through the Distribution folder through common SMS package share.
This appears to be copying to the DP just fine.
The program command line is 'cscript DeleteIcon.vbs'
and is set to run 'only when a user is logged on' with Admin rights.
All seems to run ok, I get this line in Execmgr.log
'Execution is complete for program DeleteIcons. The exit code is 0, the execution status is Success execmgr 23/01/2007 12:05:38 3980 (0x0F8C)
'

....I have 'tweaked' and tried slight changes but it doesn't work, although it ran fine from the command line.

........... Any help much appreciated



Full log is here
<![LOG[Script for Package:6500003B, Program: Delete Icon failed with exit code 1]LOG]!><time="11:16:57.983+000" date="01-23-2007" component="execmgr" context="" type="3" thread="728" file="executionstatus.cpp:243">
<![LOG[Raising event:
[SMS_CodePage(850), SMS_LocaleID(2057)]
instance of SoftDistProgramErrorEvent
{
AdvertisementId = "65020097";
ClientID = "GUID:B4A07F4F-7149-463A-B2BD-1A7E16C427A4";
DateTime = "20070123111657.983000+000";
ExitCode = "1";
MachineName = "LTKTG8M1J";
PackageName = "6500003B";
ProcessID = 1948;
ProgramName = "Delete Icon";
SiteCode = "650";
ThreadID = 728;
UserContext = "NT AUTHORITY\\SYSTEM";
};
]LOG]!><time="11:16:57.983+000" date="01-23-2007" component="execmgr" context="" type="1" thread="728" file="event.cpp:522">
<![LOG[Raised Program Error Event for Ad:65020097, Package:6500003B, Program: Delete Icon]LOG]!><time="11:16:57.983+000" date="01-23-2007" component="execmgr" context="" type="1" thread="728" file="executioncontext.cpp:504">
<![LOG[Execution is complete for program Delete Icon. The exit code is 1, the execution status is FailureNonRetry]LOG]!><time="11:16:58.061+000" date="01-23-2007" component="execmgr" context="" type="1" thread="1168" file="execreqmgr.cpp:3181">
<![LOG[Execution Manager timer has been fired.]LOG]!><time="11:19:08.982+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2144" file="execreqmgr.cpp:4287">
<![LOG[Policy arrived for parent program DeleteIcons]LOG]!><time="12:05:31.820+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2908" file="execreqmgr.cpp:4940">
<![LOG[Raising event:
[SMS_CodePage(850), SMS_LocaleID(2057)]
instance of SoftDistProgramOfferReceivedEvent
{
AdvertisementId = "6502009B";
ClientID = "GUID:B4A07F4F-7149-463A-B2BD-1A7E16C427A4";
DateTime = "20070123120531.835000+000";
MachineName = "LTKTG8M1J";
ProcessID = 1948;
SiteCode = "650";
ThreadID = 2908;
};
]LOG]!><time="12:05:31.835+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2908" file="event.cpp:522">
<![LOG[Mandatory execution requested for program DeleteIcons and advertisement 6502009B]LOG]!><time="12:05:31.835+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="execreqmgr.cpp:2761">
<![LOG[Creating mandatory request for advert 6502009B, program DeleteIcons, package 6500003C]LOG]!><time="12:05:31.835+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="execreqmgr.cpp:2858">
<![LOG[Requesting content from CAS for package 6500003C version 1]LOG]!><time="12:05:31.851+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="contentaccesshelper.cpp:136">
<![LOG[Raising event:
[SMS_CodePage(850), SMS_LocaleID(2057)]
instance of SoftDistWaitingContentEvent
{
AdvertisementId = "6502009B";
ClientID = "GUID:B4A07F4F-7149-463A-B2BD-1A7E16C427A4";
DateTime = "20070123120532.242000+000";
MachineName = "LTKTG8M1J";
PackageName = "6500003C";
PackageVersion = "1";
ProcessID = 1948;
ProgramName = "DeleteIcons";
SiteCode = "650";
ThreadID = 3980;
};
]LOG]!><time="12:05:32.242+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="event.cpp:522">
<![LOG[Successfully raised SoftDistWaitingContentEvent event for program DeleteIcons]LOG]!><time="12:05:32.257+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="executionrequest.cpp:1871">
<![LOG[Execution Request for program DeleteIcons state change from NotExist to WaitingContent]LOG]!><time="12:05:32.257+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="executionrequest.cpp:372">
<![LOG[Content is available for program DeleteIcons.]LOG]!><time="12:05:32.429+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="executionrequest.cpp:3802">
<![LOG[Notify user mandatory program DeleteIcons is about to run]LOG]!><time="12:05:32.429+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="executionrequest.cpp:2220">
<![LOG[Execution Request for program DeleteIcons state change from WaitingContent to NotifyExecution]LOG]!><time="12:05:32.523+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="executionrequest.cpp:372">
<![LOG[Executing program cscript DeleteIcon.vbs in Admin context]LOG]!><time="12:05:37.823+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="executionrequest.cpp:2375">
<![LOG[Execution Request for program DeleteIcons state change from Running to Running]LOG]!><time="12:05:37.823+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="executionrequest.cpp:372">
<![LOG[Checking content location \\DPMSS30.uk.ALTD.com\SMSPKGF$\6500003C\ for use]LOG]!><time="12:05:37.839+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="executioncontext.cpp:1467">
<![LOG[Successfully selected content location \\DPMSS30.uk.ALTD.com\SMSPKGF$\6500003C]LOG]!><time="12:05:37.964+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="executioncontext.cpp:1535">
<![LOG[Executing program as a script]LOG]!><time="12:05:37.964+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="executionengine.cpp:96">
<![LOG[Successfully prepared command line "\\DPMSS30.uk.ALTD.com\SMSPKGF$\6500003C\cscript.exe" DeleteIcon.vbs]LOG]!><time="12:05:37.964+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="scriptexecution.cpp:419">
<![LOG[Command line = "\\DPMSS30.uk.ALTD.com\SMSPKGF$\6500003C\cscript.exe" DeleteIcon.vbs, Working Directory = \\DPMSS30.uk.ALTD.com\SMSPKGF$\6500003C\]LOG]!><time="12:05:37.964+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="scriptexecution.cpp:178">
<![LOG[Created Process for the passed command line]LOG]!><time="12:05:38.011+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="scriptexecution.cpp:309">
<![LOG[Raising event:
[SMS_CodePage(850), SMS_LocaleID(2057)]
instance of SoftDistProgramStartedEvent
{
AdvertisementId = "6502009B";
ClientID = "GUID:B4A07F4F-7149-463A-B2BD-1A7E16C427A4";
CommandLine = "\"\\\\DPMSS30.uk.ALTD.com\\SMSPKGF$\\6500003C\\cscript.exe\" DeleteIcon.vbs";
DateTime = "20070123120538.011000+000";
MachineName = "LTKTG8M1J";
PackageName = "6500003C";
ProcessID = 1948;
ProgramName = "DeleteIcons";
SiteCode = "650";
ThreadID = 2192;
UserContext = "NT AUTHORITY\\SYSTEM";
WorkingDirectory = "\\\\DPMSS30.uk.ALTD.com\\SMSPKGF$\\6500003C\\";
};
]LOG]!><time="12:05:38.027+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="event.cpp:522">
<![LOG[Raised Program Started Event for Ad:6502009B, Package:6500003C, Program: DeleteIcons]LOG]!><time="12:05:38.042+000" date="01-23-2007" component="execmgr" context="" type="1" thread="2192" file="executioncontext.cpp:391">
<![LOG[Program exit code 0]LOG]!><time="12:05:38.949+000" date="01-23-2007" component="execmgr" context="" type="1" thread="544" file="scriptexecution.cpp:443">
<![LOG[Looking for MIF file to get program status]LOG]!><time="12:05:38.949+000" date="01-23-2007" component="execmgr" context="" type="1" thread="544" file="executionstatus.cpp:276">
<![LOG[Script for Package:6500003C, Program: DeleteIcons succeeded with exit code 0]LOG]!><time="12:05:38.949+000" date="01-23-2007" component="execmgr" context="" type="1" thread="544" file="executionstatus.cpp:253">
<![LOG[Raising event:
[SMS_CodePage(850), SMS_LocaleID(2057)]
instance of SoftDistProgramCompletedSuccessfullyEvent
{
AdvertisementId = "6502009B";
ClientID = "GUID:B4A07F4F-7149-463A-B2BD-1A7E16C427A4";
DateTime = "20070123120538.949000+000";
MachineName = "LTKTG8M1J";
PackageName = "6500003C";
ProcessID = 1948;
ProgramName = "DeleteIcons";
SiteCode = "650";
ThreadID = 544;
UserContext = "NT AUTHORITY\\SYSTEM";
};
]LOG]!><time="12:05:38.980+000" date="01-23-2007" component="execmgr" context="" type="1" thread="544" file="event.cpp:522">
<![LOG[Raised Program Success Event for Ad:6502009B, Package:6500003C, Program: DeleteIcons]LOG]!><time="12:05:38.980+000" date="01-23-2007" component="execmgr" context="" type="1" thread="544" file="executioncontext.cpp:413">
<![LOG[Execution is complete for program DeleteIcons. The exit code is 0, the execution status is Success]LOG]!><time="12:05:38.980+000" date="01-23-2007" component="execmgr" context="" type="1" thread="3980" file="execreqmgr.cpp:3181">
<![LOG[Execution Manager timer has been fired.]LOG]!><time="12:12:43.699+000" date="01-23-2007" component="execmgr" context="" type="1" thread="544" file="execreqmgr.cpp:4287">
 
Have you tried changing the program to 'run with drive letter'?

I've had this in the past.

Also, if that fails, you could try getting the client to download the program before running? That may help.
 

OK sorted, it needed to be 'Run with user's rights'

and I put the command line into a batch file

thanks for everyones input here..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top