SCRIPTING
FUNCTIONS
REFERENCE GUIDE
Copyright 2014 LabTech Software. All rights reserved.
Information in this document is subject to change without notice. The software described in this document is furnished under a license agreement or nondisclosure agreement. The software may be
used or copied only in accordance with the terms of those agreements. No part of this publication
may be reproduced, stored in a retrieval system, or transmitted in any form or any means electronic
or mechanical, including photocopying and recording for any purpose other than the purchaser's
personal use without the written permission of LabTech Software.
4110 George Road, Suite 200
Tampa, Florida 33634
813.397.4600
CONTENTS
CHAPTER 1
Primary IF Functions
IF AutoStartup Check
35
36
Parameters
36
Examples
36
IFConsole Logged On
40
Parameters
40
Examples
40
IFDrive Status
44
Parameters
44
Examples
44
IFEvent Log Check
54
Parameters
54
Examples
54
IFExtra Data Check
58
Parameters
58
Examples
58
IF File Check
62
Parameters
62
Examples
62
IFFile Compare
66
Parameters
66
Examples
IFGroup Member
70
Parameters
70
Examples
70
IFINI File Check
74
Parameters
74
Examples
74
IFNew Unassigned Ticket
78
Parameters
78
Examples
78
IFPatch Installed
82
Parameters
82
Examples
82
IFPerformance Counter
86
Parameters
86
Examples
86
IFProcess Exists
90
Parameters
90
Examples
90
IFRegistry Check
94
Parameters
94
Examples
94
If Role Detected
98
Parameters
98
Examples
98
IFService Is Running
102
Parameters
102
Examples
102
IFSmart Attributes
Parameters
iv
66
106
106
Examples
IFSoftware Installed
106
110
Parameters
110
Examples
110
IFSQLData Check
114
Parameters
114
Examples
114
IFTemplate Property Check
118
Parameters
118
Examples
118
IFTicket Status
122
Parameters
122
Examples
122
IFTool Installed
126
Parameters
126
Examples
126
IFTrue
Examples
IFUser Response
130
130
134
Parameters
134
Examples
134
IFVariable Check
139
Parameters
139
Examples
139
CHAPTER 2
Computer Functions
Bulk Registry Write
143
144
Parameters
144
Examples
144
Computer Functions
CONTENTS
147
Disk Check
148
Parameters
148
Examples
148
Disk Cleanup
Parameters
150
Examples
150
Disk Defrag
152
Parameters
152
Examples
152
Performance Counter Get
154
Parameters
154
Examples
154
Printer Clear Queue
156
Parameters
156
Examples
156
Printer Set Default
158
Parameters
158
Examples
158
Process Execute
160
Parameters
160
Examples
160
Process Execute As Admin
163
Parameters
163
Example
163
Process Execute As User
vi
150
165
Parameters
165
Examples
165
Process Kill
168
Parameters
168
Examples
168
Registry Delete Key
170
Parameters
170
Examples
170
Registry Set Value
173
Parameters
173
Examples
173
Service Start
180
Parameters
180
Examples
180
ServiceStartup Control
182
Parameters
182
Examples
182
Service Stop
184
Parameters
184
Examples
184
Share Create
186
Parameters
186
Examples
186
Share Delete
188
Parameters
188
Examples
188
CHAPTER 3
Computer State Functions
Hibernate
Parameters
Reboot
Parameters
Reboot Forced
Parameters
Reboot to Cmd Prompt
CONTENTS
191
192
192
193
193
194
194
195
Parameters
Reboot to Safe Mode
Parameters
Suspend
Parameters
195
196
196
197
197
CHAPTER 3
ContactFunctions
ContactFunctions
Index of Topics in Contact Functions
Contact - Script for Each
198
198
198
198
Parameters
198
Examples
198
CHAPTER 4
DatabaseFunctions
ExtraData Get Value
202
Parameters
202
Examples
202
ExtraData Set Value
204
Parameters
204
Examples
204
Script State Clear
206
Parameters
206
Examples
206
Script State Get
208
Parameters
208
Examples
208
Script State Set
211
Parameters
211
Examples
211
Script Stats Clear
viii
201
214
Parameters
214
Examples
214
Script Stats Get
216
Parameters
216
Examples
216
Script Stats Save
218
Parameters
218
Examples
218
SQLExecute
220
Parameters
220
Examples
220
SQL Fetch DataSet Row
224
Parameters
224
Examples
224
SQLGet DataSet
228
Parameters
228
Examples
228
SQLGet Value
232
Parameters
232
Examples
232
Template Property Get Value
236
Parameters
236
Examples
236
CHAPTER 5
DecisionFunctions
239
IFAutoStartup Check
240
Parameters
240
Examples
240
IF Console Logged On
Parameters
CONTENTS
243
243
Examples
243
IFDrive Status
246
Parameters
246
Examples
246
IFFile Check
254
Parameters
254
Examples
254
IFFile Compare
257
Parameters
257
Examples
257
IFGroup Member
260
Parameters
260
Examples
260
IFNew Unassigned Ticket
Parameters
263
Examples
263
IFPatch Installed
266
Parameters
266
Examples
266
IFPlugin Agent Command Available
IF PluginEnabled
IFPlugin Server Function Available
IF Process Exists
269
270
271
272
Parameters
272
Examples
272
IFRegistry Check
263
275
Parameters
275
Examples
275
IF Role Detected
278
Parameters
278
Examples
278
IFService is Running
280
Parameters
280
Examples
280
IFSmart Attributes
283
Parameters
283
Examples
283
IFSoftware Installed
286
Parameters
286
Examples
286
IFSQLData Check
289
Parameters
289
Examples
289
IF Ticket Status
292
Parameters
292
Examples
292
IFToolInstalled
293
Parameters
293
Examples
293
Examples
294
IFUser Response
296
Parameters
296
Examples
296
Match Goto
299
Parameters
299
Examples
299
CHAPTER 6
File Functions
File BITSDownload
301
302
Parameters
302
Examples
303
CONTENTS
File Copy
Parameters
308
Examples
308
File Copy As Admin
310
Parameters
310
Examples
310
File Copy As User
312
Parameters
312
Examples
312
File Delete
314
Parameters
314
Examples
314
File Delete As Admin
316
Parameters
316
Examples
316
File Delete As User
318
Parameters
318
Examples
318
File Download
320
Parameters
320
Examples
320
File Download (Forced)
322
Parameters
322
Examples
322
File Download URL
324
Parameters
324
Examples
324
File Download URL(Forced)
xii
308
326
Parameters
326
Examples
326
File Rename
328
Parameters
328
Examples
328
File Rename As Admin
330
Parameters
330
Examples
330
File Rename As User
332
Parameters
332
Examples
332
File Upload
334
Parameters
334
Examples
334
File Write Text
336
Parameters
336
Examples
336
File Zip
338
Parameters
338
Examples
338
CHAPTER 7
Folder Functions
341
Folder Create
342
Parameters
342
Examples
342
Folder Create as Admin
344
Parameters
344
Examples
344
Folder Create As User
346
Parameters
346
Examples
346
Folder Delete
CONTENTS
348
Parameters
348
Examples
348
Folder Delete As Admin
350
Parameters
350
Examples
350
Folder Delete As User
352
Parameters
352
Examples
352
Folder Move
354
Parameters
354
Examples
354
Folder Move As Admin
356
Parameters
356
Examples
356
Folder Move As User
358
Parameters
358
Examples
358
CHAPTER 8
LabTech Functions
361
LabTech Agent Uninstall
362
Parameters
362
Examples
362
LabTech Agent Update
Parameters
363
Examples
363
LabTechCommand
LabTech FasTalk
365
366
Parameters
366
Examples
366
LabTech License Deactivate
xiv
363
370
Parameters
370
Examples
370
LabTech License Retrieve
372
Parameters
372
Examples
372
LabTechPluginAlert
374
Parameters
374
Examples
374
LabTech Probe Control
376
Parameters
376
Examples
376
LabTech Send Message to Computer
380
Parameters
380
Examples
380
CHAPTER 9
LabTech Server Functions
LTServer Alert Delete
383
384
Parameters
384
Examples
384
LTServer Call AlertTemplate
387
Parameters
387
Examples
387
LTServer Create Alert
390
Parameters
390
Examples
390
LTServer Download to Server
393
Parameters
393
Examples
393
LTServer Execute
Parameters
CONTENTS
395
395
Examples
LTServer Net Send
395
397
Parameters
397
Examples
397
LTServer Pager Message
399
Parameters
399
Examples
399
LTServer Record Stat
401
Parameters
401
Examples
401
LTServer Send Fax
403
Parameters
403
Examples
403
LTServer ShellExecute
405
Parameters
405
Examples
405
LTServer Voice Message
407
Parameters
407
Examples
407
LTServer Write To File
409
Parameters
409
Examples
409
CHAPTER 10
Management Functions
Add User Accounts
412
Parameters
412
Examples
412
Generate Random Password
xvi
411
414
Parameters
414
Examples
414
Maintenance Mode Clear
416
Parameters
416
Examples
416
Maintenance Mode Start
418
Parameters
418
Examples
418
Offline Backup
420
Parameters
420
Examples
420
Patch Approve
423
Parameters
423
Examples
423
Patch Install
425
Parameters
425
Examples
425
Patch Install All
427
Parameters
427
Examples
427
Virus Definition Update
431
Parameters
431
Examples
431
Virus Scan
433
Parameters
433
Examples
433
Windows Update Settings - Disable Access to Windows Update
435
Parameters
435
Examples
435
Windows Update Settings - Disable Windows Updates
437
Parameters
437
Examples
437
CONTENTS
Windows Update Settings - Enable Windows Update Time
439
Parameters
439
Examples
439
Windows Update Settings - Force Windows Update
442
Parameters
442
Examples
442
Windows Update Settings - Install Windows Update Agent
444
Parameters
444
Examples
444
Windows Update Settings - Restore Defaults
446
Parameters
446
Examples
446
Windows Update Settings - Set LabTech Mode
448
Parameters
448
Examples
448
Windows Update Settings - Set WSUS Server
450
Parameters
450
Examples
450
Windows Update Settings - Windows Update Download Only
453
Parameters
453
Examples
453
CHAPTER 11
Mobile Command Functions
Mobile Command - Generic Command
456
Parameters
456
Examples
456
Mobile Command - Mobile Device Lock
459
Parameters
459
Examples
459
Mobile Command - Mobile Device Wipe
xviii
455
461
Parameters
461
Examples
461
Mobile Command - Require New Password
463
Parameters
463
Examples
463
Mobile Command - Reset Password
465
Parameters
465
Examples
465
Mobile Command - Set New Password
467
Parameters
467
Examples
467
Mobile Command - Set Roaming
469
Parameters
469
Examples
469
CHAPTER 11
NetworkDevice Functions
Network Device - Check Connectivity
470
471
Parameters
471
Examples
471
Index of Topics in Network Device Functions
NetworkDevice Functions
Network Device Get SNMP OID
472
473
473
Parameters
473
Examples
473
Network Device - Set SNMP OID
474
Parameters
474
Examples
474
Network Device SSH Close
476
Parameters
476
Examples
476
CONTENTS
Network Device SSHOpen
477
Parameters
477
Examples
478
Network Device - SSH Send Raw
479
Parameters
479
Examples
479
Network Device SSH Send Secure
481
Parameters
481
Examples
481
Network Device - Telnet Close
482
Parameters
482
Examples
482
Network Device - Telnet Open
483
Parameters
484
Examples
484
Network Device - Telnet Send Raw
485
Parameters
485
Examples
485
Network Device - Telnet Send Secure
487
Parameters
487
Examples
487
Network Device - Ticket Create
488
Parameters
488
Examples
488
CHAPTER 12
Network Functions
xx
491
Net DNS Lookup
492
Parameters
492
Examples
492
Net Get IP Port
494
Parameters
494
Examples
494
Net Get SNMP
496
Parameters
496
Examples
496
Net IP Config
498
Parameters
498
Examples
498
Net Ping
499
Parameters
499
Examples
499
New Renew IP
501
Parameters
501
Examples
501
Net Set SNMP
502
Parameters
502
Examples
502
Net TFTP Send
504
Parameters
504
Examples
504
Net Wake on LAN
507
Parameters
507
Examples
507
CHAPTER 13
Remote Management Functions
509
Console Execute
510
Parameters
510
Examples
510
Console Logoff User
Parameters
CONTENTS
515
515
Examples
Console Open Browser
520
Parameters
520
Examples
520
Console Registry Read
525
Parameters
525
Examples
525
Console Screen Capture
530
Parameters
530
Examples
530
Console Shell
535
Parameters
535
Examples
535
Console Show Message
540
Parameters
540
Examples
540
SSH Close Connection
545
Parameters
545
Examples
545
SSH Open Connection
549
Parameters
549
Examples
549
SSH Send Raw
553
Parameters
553
Examples
553
SSH Send Secure
557
Parameters
557
Examples
557
Telnet Close Connection
Parameters
xxii
515
561
561
Examples
Telnet Open Connection
561
565
Parameters
565
Examples
565
Telnet Send Raw
569
Parameters
569
Examples
569
Telnet Send Secure
573
Parameters
573
Examples
573
CHAPTER 14
Resend Functions
Resend Autostartup List
577
578
Parameters
578
Examples
578
Resend Config
580
Parameters
580
Examples
580
Resend Drive Info
581
Parameters
581
Examples
581
Resend Error Logs
583
Parameters
583
Examples
583
Resend Event Logs
584
Parameters
584
Examples
584
Resend Everything
586
Parameters
586
Examples
586
CONTENTS
Resend Hardware
588
Parameters
588
Examples
588
Resend Network Information
590
Parameters
590
Examples
590
Resend Patch Information
592
Parameters
592
Examples
592
Resend Printers
594
Parameters
594
Examples
594
Resend Process List
595
Parameters
595
Examples
595
Resend Service List
597
Parameters
597
Examples
597
Resend Software
598
Parameters
598
Examples
598
Resend System Information
600
Parameters
600
Examples
600
CHAPTER 15
Script Functions
Script Call
603
Parameters
603
Examples
603
Script Exit with Error
xxiv
603
605
Parameters
605
Examples
605
Script for Each
606
Parameters
606
Examples
606
Script for Each SQL
608
Parameters
608
Examples
608
Script Goto
610
Parameters
610
Examples
610
Script Log Message
614
Parameters
614
Examples
614
Script Math
618
Parameters
618
Examples
618
Script Note
649
Parameters
649
Examples
649
Script RegEx
652
Parameters
652
Examples
652
Script Return
653
Parameters
653
Examples
653
Script Run
655
Parameters
655
Examples
655
Script Sleep
CONTENTS
658
Parameters
658
Examples
658
CHAPTER 16
Script String Functions
Decrypt Operation
661
662
Parameters
662
Examples
662
Decrypt Version Two Operation
665
Parameters
665
Examples
665
Encrypt Operation
668
Parameters
668
Examples
668
Encrypt Version Two Operation
671
Parameters
671
Examples
671
Find String Operation
674
Parameters
674
Examples
674
HTML Decode Operation
676
Parameters
676
Examples
676
HTML Encode Operation
678
Parameters
678
Examples
678
Insert Operation
680
Parameters
680
Examples
680
LabTech Pipe Decode
Parameters
xxvi
682
682
Examples
LabTech Pipe Encode
682
684
Parameters
684
Examples
684
Last Find String Operation
686
Parameters
686
Examples
686
Left Operation
688
Parameters
688
Examples
688
Lower Case Operation
693
Parameters
693
Examples
693
Middle Operation
696
Parameters
696
Examples
696
MySQL Encode Operation
701
Parameters
701
Examples
701
Replace Operation
703
Parameters
703
Examples
703
Reverse Operation
706
Parameters
706
Examples
706
Right Operation
708
Parameters
708
Examples
708
Split Operation
713
Parameters
CONTENTS
713
Examples
Trim Spaces Operation
713
716
Parameters
716
Examples
716
Upper Case Operation
718
Parameters
718
Examples
718
URL Decode Operation
721
Parameters
721
Examples
721
URL Encode Operation
723
Parameters
723
Examples
723
CHAPTER 17
Shell Functions
Execute Script
725
726
Parameters
726
Examples
726
Power Shell Command
729
Parameters
729
Examples
729
PowerShell Command as Admin
731
Parameters
731
Examples
731
Shell
733
Parameters
733
Examples
733
Shell as Admin
735
xxviii
Parameters
735
Examples
735
Shell as User
737
Parameters
737
Examples
737
Shell Enhanced
739
Parameters
739
Examples
739
CHAPTER 18
Software Functions
Email
743
744
Parameters
744
Examples
744
Email Alerts
746
Parameters
746
Examples
746
Email Load Attachment
748
Parameters
748
Examples
748
Play Sound
750
Parameters
750
Examples
750
Plugin Agent Command
Plugin Server Function
Report Email
752
753
754
Parameters
754
Examples
754
Report Print
756
Parameters
756
Examples
756
Tool Install
758
Parameters
CONTENTS
758
CHAPTER 19
Ticket Functions
759
Ticket Add Time
760
Parameters
760
Examples
760
Ticket Assign
762
Parameters
762
Examples
762
Ticket Attach File
764
Parameters
764
Examples
764
Ticket Combine
766
Parameters
766
Examples
766
Ticket Comment
768
Parameters
768
Examples
768
Ticket Create
771
Parameters
771
Examples
771
Ticket Elevate
773
Parameters
773
Examples
773
Ticket Finish
775
Parameters
775
Examples
775
Ticket Open
Parameters
777
Examples
777
Ticket Reading View
xxx
777
779
Parameters
779
Examples
779
Ticket Stall
782
Parameters
782
Examples
782
Ticket Update
785
Parameters
785
Examples
785
CHAPTER 20
Variable Functions
Variable Check
787
788
Parameters
788
Examples
788
Variable Set: All Local Variables
791
Parameters:
791
Example:
791
Variable Set: Constant
793
Parameters
793
Examples
793
Variable Set: Current ClientID Variable
796
Parameters:
796
Example:
796
Variable Set: Current ComputerID Variable
798
Parameters:
798
Example:
798
VariableSet: Current Console Number Variable
800
Parameters:
800
Example:
800
Variable Set: Current LocationID Variable
Parameters:
CONTENTS
802
802
Example:
Variable Set: Expand on Agent Variable
804
Parameters:
804
Example:
804
Variable Set: File Contents Variable
806
Parameters:
806
Example:
806
Variable Set: File Date Variable
808
Parameters:
808
Example:
808
Variable Set: File MD5 Hash Variable
810
Parameters:
810
Example:
810
Variable Set: File Size Variable
812
Parameters:
812
Example:
812
Variable Set: File Version Variable
814
Parameters:
814
Example:
814
Variable Set: Get Virus Scanner Variables
816
Parameters:
816
Example:
816
Variable Set: Properties Variable
818
Parameters:
818
Example:
818
Variable Set: Registry Variable
820
Parameters
820
Example
820
Variable Set:Reload Computer Variables
Parameters:
xxxii
802
822
822
Example:
Variable Set: Split Name Value Parameter Variables
822
824
Parameters:
824
Example:
824
Variable Set: SQL Query Variable
826
Parameters:
826
Example:
826
Variable Set: Temp Directory Variable
828
Parameters:
828
Example:
828
INDEX
CONTENTS
831
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
xxxiv
CHAPTER 1
Primary IF Functions
This chapter provides parameter information, as well as examples for the various IF functions available within LabTech.
IF AutoStartup Check
36
IFConsole Logged On
40
IFDrive Status
44
IFEvent Log Check
54
IFExtra Data Check
58
IF File Check
62
IFFile Compare
66
IFGroup Member
70
IFINI File Check
74
IFNew Unassigned Ticket
78
IFPatch Installed
82
IFPerformance Counter
86
IFProcess Exists
90
IFRegistry Check
94
If Role Detected
98
IFService Is Running
102
IFSmart Attributes
106
IFSoftware Installed
110
IFSQLData Check
114
IFTemplate Property Check
118
IFTicket Status
122
IFTool Installed
126
IFTrue
130
IFUser Response
134
IFVariable Check
139
IF AutoStartup Check
Sets the %=autostartupvalue%= variable and runs in the THEN component if the result of the comparison is TRUE. Otherwise, it runs in the ELSE component. This runs on the server.
Parameters
o
AutoStart Def: Select the location to check from drop-down menu. The list of locations is
retrieved from database (e.g., Boot Execute, Boot Pending File Rename, NTRun, etc.).
Compare: Select logical operator from drop-down menu. (Exists, Not Exists, =, Not =, <,
<=, >, >=, Contains, Not Contains). 'Exists' returns 'True' if AutoStart Def has any data.
To:The data to compare to the startup value.
Examples
Example #1: Launches the '_LTSG AutoStartup Check If Component Function' example script.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Auto Startup Check
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Auto Startup Check in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
36
Script Run function
Parameters:
o
Script ID:_LTSG AutoStartup Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG AutoStartup Check IF Component Function from the Script ID dropdown.
4. Leave the Delay field blank.
5. Click Save Step to save this step and close the window.
_LTSGAutoStartupCheck IFComponent Function example script
Parameters:
IF:AutoStartup Check
o
AutoStart Def: Boot Execute
Compare: Exists
To:
Using the function examples in a new or existing script :
1. From a new or existing script, select AutoStartup Check from the IF drop-down.
2. Enter Boot Executive in the AutoStart Def field.
3. Select Exists from the Compare drop-down.
4. Leave the To field blank for this example.
5. Click Save to save this step and close the window.
38
IFConsole Logged On
Sets the %=consolenumber%= variable and runs in the THEN component if a user is logged on.
Otherwise, it runs in the ELSE component. This runs on the agent.
Parameters
o
Username: Enter the username to check if the specific user is logged on. Leave blank for
anyone.
Examples
Example #1: Launches the '_Console Logged On IFComponent Function' example script.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Console Logged On
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Console Logged On in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
40
Script Run function
Parameters:
o
Script ID:_LTSG Console Logged On IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Console Logged On IF Component Function from the Script ID field.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGConsole Logged On IFComponent Function example script
Parameters:
IF:Console Logged On
o
Username: @LTSG_UserName@
Using the function examples in a new or existing script :
1. From a new or existing script, select Console Logged On from the IF drop-down.
2. Enter @LTSG_UserName@ in the Username field.
3. Click Save to save this step and close the window.
42
IFDrive Status
Sets the %=driveletter%= variable and runs in the THEN component if free space is lower than the
minimum or fragmentation is greater than the maximum limits. Otherwise, it runs in the ELSE component. This runs on the server.
Parameters
o
FreeSpace: Minimum percentage of free space
Fragmentation: Maximum fragmentation percentage that is acceptable for this drive.
MFTFrag: Maximum Master File Table fragmentation percentage that is acceptable.
Examples
Example #1: Launches the '_Drive Status Fragmentation IF Component Function' example script
and checks the fragmentation for the drive and that it is not greater than 10 percent.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Drive Status - Fragmentation
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Drive Status - Fragmentation in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
44
Script Run function
Parameters:
o
Script ID:_LTSG Drive Status - Fragmentation IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Drive Status - Fragmentation IF Component Function from the Script
ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGDrive Status - Fragmentation IFComponent Function example script
Parameters:
IF:Drive Status
o
FreeSpace:
Fragmentation: 10
MFTFrag:
Using the function examples in a new or existing script :
1. From a new or existing script, select Drive Status from the IF drop-down.
2. Leave the FreeSpace field blank for this example.
3. Enter 10 in the Fragmentation field.
4. Leave the MFT Frag field blank for this example.
5. Click Save to save this step and close the window.
46
Example #2: Launches the '_Drive Status FreeSpace IF Component Function' example script
and checks the free space of the drive to ensure that there is a minimum of 75% percent free
space.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Drive Status - Free Space
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Drive Status - Free Space in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
Script Run function
Parameters:
o
Script ID:_LTSG Drive Status - Free Space IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Drive Status - Free Space IF Component Function from the Script ID
drop-down.
4. Leave the Delay field blank for this example.
48
5. Click Save Step to save this step and close the window.
_LTSGDrive Status - Free Space IFComponent Function example script
Parameters:
IF:Drive Status
o
FreeSpace: 75
Fragmentation:
MFTFrag:
Using the function examples in a new or existing script :
1. From a new or existing script, select Drive Status from the IF drop-down.
2. Enter 75 in the FreeSpace field.
3. Leave the Fragmentation field blank for this example.
4. Leave the MFT Frag field blank for this example.
5. Click Save to save this step and close the window.
Example #3: Launches the '_Drive Status MFTFrag IF Component Function' example script and
checks MFTfragmentation for the drive and that it is not greater than 5 percent.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Drive Status - MFTFrag
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Drive Status - MFT Frag in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
50
6. Click Save Step to save this step and close the window.
Script Run function
Parameters:
o
Script ID:_LTSG Drive Status - MFTFrag IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Enter _LTSG Drive Status - MFTFrag IF Component Function in the Script ID field.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGDrive Status - MFTFrag IFComponent Function example script
Parameters:
IF:Drive Status
o
FreeSpace:
Fragmentation:
MFTFrag: 5
Using the function examples in a new or existing script :
1. From a new or existing script, select Drive Status from the IF drop-down.
2. Leave the FreeSpace field blank for this example.
3. Leave the Fragmentation field blank for this example.
4. Enter 5 in the MFT Frag field.
5. Click Save to save this step and close the window.
52
IFEvent Log Check
Checks the last 24 hours of an event logs for specified messages. Sets the %=evenntlogmessage%= variable and runs in the THEN component if the result of the comparison is
'True'. Otherwise, it runs in the ELSE component. This runs on the server.
Parameters
o
Log Name: Name of the Log File to test (e.g., Application)
Source: Enter the source of the event log (e.g. Microsoft-Windows-defrag) or leave blank
for all entries.
Event Type: Select the type of event to match on from the drop-down (e.g., Security, Error,
Information, Warning).
Compare: Select logical operator from drop-down menu. (Exists, Not Exists, =, Not =, <,
<=, >, >=, Contains, Not Contains) (Exists returns true if counter has any data).
To:The message portion of the event log message to compare to.
Examples
Example #1: Launches the '_LTSG Event Log Check IFComponent Function' example script and
determines if the log exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Event Log Check
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Event Log Check in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
54
Script Run function
Parameters:
o
Script ID:_LTSG Event Log Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Event Log Check IF Component Function from the Script ID field.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGEvent Log Check IFComponent Function example script
Parameters:
IF: Event Log Check
o
Log Name: Application
Source: Microsoft-Windows-defrag
Event Type: Information
Compare: Exists
To:
Using the function examples in a new or existing script :
1. From a new or existing script, select Event Log Check from the IF drop-down.
2. Enter Application in the Log Name field.
3. Enter Microsoft-Windows-defrag in the Source field.
4. Select Information in the Event Type drop-down.
56
5. Select Exists in the Compare drop-down.
6. Leave the To field blank for this example.
7. Click Save to save this step and close the window.
IFExtra Data Check
Checks an extra data field for a specified value and runs in the THEN component if the result of the
comparison is 'True'. Otherwise, it runs in the ELSE component. This runs on the server.
Parameters
o
Extra Field: Select the extra data field to check from the drop-down. The list of extra data
fields is populated from the database.
ID: Enter the type of ID required. The field ends with the type of ID needed (1=computerid,
2=locaitonid, 3=clientid, 4=probeid, 5=deviceid, 6=ticketid, 7=groupid). For example, for
extra data field 'Skip Missing Virus Scanner-3', use a client ID like '%=clientid%'.
Compare: Select logical operator from drop-down menu. (Exists, Not Exists, =, Not =, <,
<=, >, >=, Contains, Not Contains) (Exists returns true if counter has any data).
To:The data to compare the results to.
Examples
Example #1: Launches the '_LTSG ExtraData Check IFComponent Function' example script and
checks if Skip Missing Virus-3 extra data field exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: ExtraDataCheck
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter ExtraData Check in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
58
Script Run function
Parameters:
o
Script ID:_LTSG ExtraData Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Enter _LTSG ExtraData Check IF Component Function in the Script ID field.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGExtraData Check IFComponent Function example script
Parameters:
IF: ExtraData Check
o
Extra Field: Skip Missing VIrus-3
ID: %computerid%
Compare: Exists
To:
Using the function examples in a new or existing script :
1. From a new or existing script, select ExtraData Check from the IF drop-down.
2. Select Skip Missing Virus Scanner -3 from the Extra Field drop-down.
3. Enter %clientid% in the ID field.
4. Select Exists from the Compare drop-down.
5. Leave the To field blank for this example.
60
6. Click Save to save this step and close the window.
IF File Check
Checks if the file or directory exists or does not exist and runs in the THEN component if the result
of the comparison is 'True'. Otherwise, it runs in the ELSE component. This runs on the agent.
Parameters
o
File Path: Enter the full path to the file to test. End the path with a \ to indicate a directory.
Exists/Not Exists: Select 'Exists' or 'Not Exists' from the drop-down (returns 'True' if condition is met)
Examples
Example #1: Launches the '_LTSG File Check IFComponent Function' example script and
checks if the %tempdir%\LTSG\LTSG_File_1.txt file exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: File Check
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter File Check in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
62
Script Run function
Parameters:
o
Script ID:_LTSG File Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG File Check IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGFile Check IFComponent Function example script
Parameters:
IF: File Check
o
File Path: %tempdir%\LTSG\LTSG_File_1.txt
Exists/Not Exists:Exists
Using the function examples in a new or existing script :
1. From a new or existing script, select File Check from the IF drop-down.
2. Enter %tempdir%\LTSG\LTSG_File_1.txt in the File Path field.
3. Select Exists from the drop-down.
4. Click Save to save this step and close the window.
64
IFFile Compare
Compares two files on the agent and runs in the THEN component if the result of the comparison is
'True'. Otherwise, it runs in the ELSE component. This runs on the agent.
Parameters
o
Check Type: Select the type of file compare to perform from the drop-down (Created, Modified, Accessed, Version, Contents, Size, MD5)
File #1: Full path to the filename without quotes
File #2: Full path to the filename without quotes
Examples
Example #1: Launches the '_LTSG File Compare IFComponent Function' example script and
compares the two files using the MD5 cryptographic hash function and returns 'True' if the files are
the same.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: File Compare
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter File Compare in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
66
Script Run function
Parameters:
o
Script ID:_LTSG FileCompare IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG File Compare IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGFileCompare IFComponent Function example script
Parameters:
IF: File Compare
o
Check Type: MD5
File #1: %tempdir%\LTSG\LTSG_File_1.txt
File #2: %tempdir%\LTSG\LTSG_File_2.txt
Using the function examples in a new or existing script :
1. From a new or existing script, select File Compare from the IF drop-down.
2. Select MD5 from the Check Type drop-down.
3. Enter %tempdir%\LTSG\LTSG_File_1.txt in the File #1 field.
4. Enter %tempdir%\LTSG\LTSG_File_2.txt in the File #2 field.
5. Click Save to save this step and close the window.
68
IFGroup Member
If the computer is a member of the selected group it runs in the THEN component. Otherwise, it
runs in the ELSE component. This runs on the server.
Parameters
o
Group Name: Select the group name from the drop-down. The list of group names is
retrieved from database.
Computer ID: Full path to the filename without quotes
Examples
Example #1: Launches the '_LTSG GroupMember IFComponent Function' example script and
determines if the computer is a member of the selected group.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Group Member
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Group Member in Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
70
Script Run function
Parameters:
o
Script ID:_LTSG Group Member IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Group Member IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGGroup Member IFComponent Function example script
Parameters:
IF: Group Member
o
Group Type: All Clients.XYZComputers
Computer ID: %computerid%
Using the function examples in a new or existing script :
1. From a new or existing script, select Group Member from the IF drop-down.
2. Enter All Clients.LabTech in the Group Name field.
3. Enter %computerid% in the Computer ID field.
4. Click Save to save this step and close the window.
72
IFINI File Check
Tests a Value in an INI file. Sets the %=iniresult%= variable to the value of the INI file key and runs
in the THEN component if the result of the comparison is 'True'. Otherwise, it runs in the ELSE component.This runs on the agent.
Parameters
o
File Path: %windir%\ODBCINST.INI
Section: MySQL ODBC3.51 Driver (32 bit)
Key:Driver
Compare:Exists
To:
Examples
Example #1: Launches the '_LTSG INIFile Check IFComponent Function' example script and
determines if the driver key exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: INIFile Check
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter INI File Check in Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
74
Script Run function
Parameters:
o
Script ID:_LTSG INIFile Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG INI File Check IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGINI File Check IFComponent Function example script
Parameters:
IF: INIFile Check
o
File Path: %windir%\ODBCINST.INI
Section: MySQL ODBC3.51 Driver (32 bit)
Key:Driver
Compare:Exists
To:
Using the function examples in a new or existing script :
1. From a new or existing script, select INI File Check from the IF drop-down.
2. Enter %windir%\ODBCINST.INI in the File Path field.
3. Enter MySQL ODBC 3.51 Driver (32bit) in the Section field.
4. Enter Driver in the Key field.
76
5. Select Exists from the Compare drop-down menu.
6. Leave the To field blank for this example.
7. Click Save to save this step and close the window.
IFNew Unassigned Ticket
If any new unassigned tickets exist, it sets the %=ticketid%= variable and runs in the THEN component. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Client ID: The client to search or leave blank for all clients.
Examples
Example #1: Launches the '_LTSG New Unassigned Ticket IFComponent Function' example
script and determines if any new unassigned tickets exist for the client.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: New Unassigned Ticket
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter New Unassigned Ticket in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
78
Script Run function
Parameters:
o
Script ID:_LTSG New Unassigned Ticket IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG New Unassigned Ticket IF Component Function from the Script ID
drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGNew Unassigned TIcket IFComponent Function example script
Parameters:
IF: New Unassigned Ticket
o
Client ID: %clientid%
Using the function examples in a new or existing script :
1. From a new or existing script, select New Unassigned Ticket from the IF drop-down.
2. Enter %clientid% in the Client ID field.
3. Click Save to save this step and close the window.
80
IFPatch Installed
If the patch is installed, it runs in the THEN component. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Patch ID: Select the patch name from the drop-down. The list of patch names is retrieved
from the database.
Examples
Example #1: Launches the '_LTSG Patch Installed IFComponent Function' example script to
determine if the patch is installed.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Patch Installed
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Patch Installed in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
82
Script Run function
Parameters:
o
Script ID:_LTSG Patch Installed IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Enter _LTSG Patch Installed IF Component Function in the Script ID field.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGPatch Installed IFComponent Function example script
Parameters:
IF: Patch Installed
o
Patch ID: 2007 Microsoft Office Suite Service Pack 1 (SP1)
Using the function examples in a new or existing script :
1. From a new or existing script, select Patch Installed from the IF drop-down.
2. Select 2007 Microsoft Office Suite Service Pack 1 (SP1) from the Patch ID drop-down.
3. Click Save to save this step and close the window.
84
IFPerformance Counter
Compares a performance counter value to a specified value, sets the %=perfresult%= variable to
the value of the performance counter and runs in the THEN component if the result of the comparison is 'True'. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Category: Performance Category
Counter: Counter Name
Instance: Instance Name
Compare: Select a logical operator from the drop-down (Exists, Not Exists, =, Not =, <, <=,
>, >=, Contains, Not Contains). 'Exists' returns 'True' if counter has any data.
To: The data to compare the results of the performance counter value to.
Examples
Example #1: Launches the '_LTSG Performance Counter IFComponent Function' example script
to determine if the Memory performance counter is less than 100.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Performance Counter
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Performance Counter in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
86
Script Run function
Parameters:
o
Script ID:_LTSG Performance Counter IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Performance Counter IF Component Function from the Script ID dropdown.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGPerformance Counter IFComponent Function example script
Parameters:
IF: Performance Counter
o
Category: Memory
Counter: Available MBytes
Instance:
Compare: >
To: 100
Using the function examples in a new or existing script :
1. From a new or existing script, select Performance Counter from the IF drop-down.
2. Enter Memory in the Category field.
3. Enter Available MBytes in the Counter field.
4. Leave the Instance field blank for this example.
88
5. Select > from the Compare drop-down.
6. Enter 100 in the To field.
7. Click Save to save this step and close the window.
IFProcess Exists
If the specified process is running, it sets the %=processid%= variable and runs in the THEN component. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Process Name: Process name or ID of process to check
Examples
Example #1: Launches the '_LTSG Process Exists IFComponent Function' example script to
determine if the process exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Process Exists
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Process Exists in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
90
Script Run function
Parameters:
o
Script ID:_LTSG Process Exists IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Process Exists IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGProcess Exists IFComponent Function example script
Parameters:
IF: Process Exists
o
Process Name: @LTSG_ProcessName@
Using the function examples in a new or existing script :
1. From a new or existing script, select Process Exists from the IF drop-down.
2. Enter @LTSG_ProcessName@ in the Process Name field.
3. Click Save to save this step and close the window.
92
IFRegistry Check
Checks a registry key or value. The %=registryresult%= variable is set to 'Key Exists' or '-9999' if
checking a registry key or the data assigned to the registry value being checked. If the result of the
comparison is 'True', it runs in the THEN component. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Registry Key: Enter the registry key or value to check.If a key, end the value name with a \
to indicate a key rather than a value.
Compare: Select the logical operator from the drop-down (Exists, Not Exists, =, Not =, <,
<=, >, >=, Contains, Not Contains). 'Exists' and 'Not Exists' are the only applicable options
for registry keys.
Examples
Example #1: Launches the '_LTSG Registry Check IFComponent Function' example script to
determine if the registry key/value exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Registry Check
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Registry Check in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
94
Script Run function
Parameters:
o
Script ID:_LTSG Registry Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Registry Check IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGRegistry Check IFComponent Function example script
Parameters:
IF: Registry Check
o
Registry Key: @LTSG_RegistryKey@
Compare: Exists
Using the function examples in a new or existing script :
1. From a new or existing script, select Registry Check from the IF drop-down.
2. Enter @LTSG_RegistryName@ in the Registry Key field.
3. Select Exists from the Compare drop-down.
4. Leave the To field blank for this example.
5. Click Save to save this step and close the window.
96
If Role Detected
If the specified role is detected, runs in the THEN component. Otherwise, it runs in the ELSE component. This runs on the server.
Parameters
o
Role Definition: Select the Role Definition from the drop-down. The list of roles are populated based on the roles in the database. A role will not be displayed if it does not exist in the
database.
Examples
Example #1: Launches the '_LTSG Role Detected IF Component Function' example script
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Role Detected
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Role Detected in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
98
Script Run function
Parameters:
o
Script ID:_LTSG Role Detected IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Enter _LTSG Role Detected IF Component Function in the Script ID field.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGRole Detected IFComponent Function example script
Parameters:
IF: Role Detected
o
Role Definition: Windows File Server
Using the function examples in a new or existing script :
1. From a new or existing script, select Role Detected from the IF drop-down.
2. Select Windows File Server from the Role Definition drop-down.
3. Click Save to save this step and close the window.
100
IFService Is Running
If the specified service is running, it sets the %=servicename%= variable and runs in the THEN
component. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Service Name: Service name or IDto check
Examples
Example #1: Launches the '_LTSG Service is Running IFComponent Function' example script to
determine if the service is running.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Service Is Running
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Service is Running in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
102
Script Run function
Parameters:
o
Script ID:_LTSG Service Is Running IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _ LTSG Service Is Running IF Component Function from the Script ID dropdown.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGService Is Running IFComponent Function example script
Parameters:
IF: Service Is Running
o
Service Name: spooler
Using the function examples in a new or existing script :
1. From a new or existing script, select Service is Running from the IF drop-down.
2. Enter spooler in the Service Name field.
3. Click Save to save this step and close the window.
104
IFSmart Attributes
If the specified SMARTAttribute indicates a failure, it sets the %=smartresult%= variable and runs
in the THEN component. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Smart Attribute: Select the attribute to test from the drop-down. The list of smart attributes
is retrieved from the database.
Examples
Example #1: Launches the '_LTSG Smart Attributes IFComponent Function' example script to
determine if the Realloc Sector Count SMARTattribute indicates a failure.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Smart Attributes
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Smart Attributes in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
106
Script Run function
Parameters:
o
Script ID:_LTSG Smart Attributes IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _ LTSG Smart Attributes IF Component Function from the Script ID dropdown.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGSmart Attributes IFComponent Function example script
Parameters:
IF: Smart Attributes
o
Smart Attribute: Realloc Sector Count
Using the function examples in a new or existing script :
1. From a new or existing script, select Smart Attributes from the IF drop-down.
2. Enter Realloc Sector Count in the Smart Attribute field.
3. Click Save to save this step and close the window.
108
IFSoftware Installed
If the specified software package is installed, it sets the %=softwarelocation%= variable and runs in
the THEN component. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
App Name: The name of the application to look for
Examples
Example #1: Launches the '_LTSG Software Installed IFComponent Function' example script to
determine if the specified software application is installed.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Software Installed
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Software Installed in the Parameter drop-down.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
110
Script Run function
Parameters:
o
Script ID:_LTSG Software Installed IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _ LTSG Software Installed IF Component Function from the Script ID dropdown.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGSoftware Installed IFComponent Function example script
Parameters:
IF: Software Installed
o
App Name: @LTSG_SoftwareInstalled@
Using the function examples in a new or existing script :
1. From a new or existing script, select Software Installed from the IF drop-down.
2. Enter @LTSG_SoftwareInstalled@ in the App Name field.
3. Click Save to save this step and close the window.
112
IFSQLData Check
Compares the results of a SQL query with a specified value, sets the %=sqlresult%= variable and
runs in the THEN component if the result of the comparison is 'True'. Otherwise, it runs in the
ELSE component.This runs on the server.
Parameters
o
Sql Statement: SQLquery that returns a single value
Compare: Select the logical operator from the drop-down (Exists, Not Exists, =, Not =, <,
<=, >, >=, Contains, Not Contains). 'Exists' returns 'True' if the query returns any data.
To: The data to compare the SQLquery to.
Examples
Example #1: Launches the '_LTSG SQLData Check IFComponent Function' example script and
returns 'True' if the SQLquery returns any data.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: SQLData Check
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter SQL Data Check in the Parameter drop-down.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
114
Script Run function
Parameters:
o
Script ID:_LTSG SQLData Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _ LTSG SQL Data Check IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGSQLData Check IFComponent Function example script
Parameters:
IF: SQLData Check
o
Sql Statement: SELECT DISTINCT os FROM computers WHERE computerid = %computerid%;
Compare: Exists
To:
Using the function examples in a new or existing script :
1. From a new or existing script, select SQL Data Check from the IF drop-down.
2. Enter SELECT DISTINCT os FROM computers WHERE computerid = %computerid%; in the Sql Statement field.
3. Select Exists from the Compare drop-down.
4. Leave the To field blank for this example.
5. Leave the ODBC Connection field blank for this example.
116
6. Click Save to save this step and close the window.
IFTemplate Property Check
Compares the template property with a specified value and runs in the THEN component if the result of the comparison is 'True'. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Property Name: Select the template property from the drop-down. The list of template properties is retrieved from the database.
Compare: Select the logical operator from the drop-down (Exists, Not Exists, =, Not =, <,
<=, >, >=, Contains, Not Contains). 'Exists' returns 'True' if the query returns any data.
To: The data to compare the SQLquery to.
Examples
Example #1: Launches the '_LTSG Template Property Check IFComponent Function' example
script and returns 'True' if the template property exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Template Property Check
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Template Property Check in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
118
Script Run function
Parameters:
o
Script ID:_LTSG Template Property Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Template Property Check IF Component Function from the Script ID
drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGTemplate Property Check IFComponent Function example script
Parameters:
IF: Template Property Check
o
Property Name: Ignore_Accumulation
Compare: Exists
To:
Using the function examples in a new or existing script :
1. From a new or existing script, select Template Property Check from the IF drop-down.
2. Enter Ignore_Accumulation in the Property Name field.
3. Select Exists from the Compare drop-down.
4. Leave the To field blank for this example.
5. Click Save to save this step and close the window.
120
IFTicket Status
Compares the status of a ticket to the selected status and runs in the THEN component if the result
of the comparison is 'True'. Otherwise, it runs in the ELSE component.This runs on the server.
Parameters
o
Ticket ID: Ticket IDto test
Status: Select the status to compare to from the drop-down (Exists, New, Open, Stalled,
Resolved, Billed, Combined).
Examples
Example #1: Launches the '_LTSG Ticket StatusIFComponent Function' example script and
returns 'True' if the ticket exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Ticket Status
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Ticket Status in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
122
Script Run function
Parameters:
o
Script ID:_LTSG Ticket Status IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Ticket Status IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGTicket Status IFComponent Function example script
Parameters:
IF: Ticket Status
o
Ticket ID: %ticketid%
Status: Exists
Using the function examples in a new or existing script :
1. From a new or existing script, select Ticket Status from the IF drop-down.
2. Enter %ticketid% in the Ticket ID field.
3. Enter Exists in the Status field.
4. Click Save to save this step and close the window.
124
IFTool Installed
If the specified tool or tweak is installed, it runs in the THEN component . Otherwise, it runs in the
ELSE component.This runs on the server.
Parameters
o
Tool ID: Select the tool/tweak from the drop-down. The list of tools/tweaks is retrieved from
the database.
Examples
Example #1: Launches the '_LTSG Tool Installed IFComponent Function' example script and
returns 'True' if the tool/tweak exists.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Tool Installed
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Tool Installed in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
126
Script Run function
Parameters:
o
Script ID:_LTSG Tool Installed IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Tool Installed IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGTool Installed IFComponent Function example script
Parameters:
IF: Tool Installed
o
Tool ID: DCDiag
Using the function examples in a new or existing script :
1. From a new or existing script, select Tool Installed from the IF drop-down.
2. Select DCDiag from the Tool ID drop-down.
3. Click Save to save this step and close the window.
128
IFTrue
Always runs the THEN component.This runs on the server.
Examples
Example #1: Launches the '_LTSG Template Property Check IFComponent Function' example
script and runs the THENcomponent of the script.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: True
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter True in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
130
Script Run function
Parameters:
o
Script ID:_LTSG Template Property Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG True IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
_LTSGTrue IFComponent Function example script
Parameters:
IF: True
Using the function examples in a new or existing script :
1. From a new or existing script, select True from the IF drop-down.
2. Click Save to save this step and close the window.
132
IFUser Response
Displays a 'yes' or 'no' question to a user in a dialog box and runs the THEN component if the
response is 'yes' or the ELSE component if the response is 'no'.This runs on the agent.
Parameters
o
Question: The question to ask
Console Number: Console number (computer ID)to ask the question on. Use the
'IFConsole Logged On' function to determine if user is logged on.
Examples
Example #1: Launches the '_LTSG User Response IFComponent Function' example script and
prompts the user on the specified console to respond 'yes' or 'no' to question.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: User Response
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter User Response in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
134
IFConsole Logged On function
Parameters:
o
Username:Constant
Steps to Skip: :LTSG_UserLoggedOn
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Leave the Username field blank for this example.
3. Enter :LTSG_UserLoggedOn in the Steps To Skip field.
4. Click Save Step to save this step and close the window.
Script Run function
Parameters:
o
Script ID:_LTSG User Response IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG User Response IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
136
_LTSGUser Response IFComponent Function example script
Parameters:
IF: User Response
o
Question: Are You Automated?
Console Number: %consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, select User Response from the IF drop-down.
2. Enter Are You Automated? in the Question field.
3. Enter %consolenumber% in the Console Number field.
4. Click Save to save this step and close the window.
138
IFVariable Check
Compares the value of a variable with a specified values and runs in the THEN component if the
result of the comparison is 'True'. Otherwise, it runs in the ELSE component.This runs on the
server.
Parameters
o
Test the Variable: Enter variable name to test, without the @quotes@
Compare: Select the logical operator from the drop-down (Exists, Not Exists, =, Not =, <,
<=, >, >=, Contains, Not Contains). 'Exists' returns 'True' if the query returns any data.
To: The data to compare to the value of the variable
Examples
Example #1: Launches the '_LTSG Variable Check IFComponent Function' example script and
returns 'True' if the value of the variable is the same as the specified value.
Variable Set function
Parameters:
o
Set Type:Constant
Parameter: Variable Check
Variable Name:LTSG_Function Name
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Variable Check in the Parameter field.
5. Enter LTSG_FunctionName in the Variable Name field.
6. Click Save Step to save this step and close the window.
Script Run function
Parameters:
o
Script ID:_LTSG Variable Check IF Component Function
Delay:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _LTSG Variable Check IF Component Function from the Script ID drop-down.
4. Leave the Delay field blank for this example.
5. Click Save Step to save this step and close the window.
140
_LTSGVariable Check IFComponent Function example script
Parameters:
IF: Variable Check
o
Test the Variable: LTSG_FunctionName
Compare: Exists
To:
Using the function examples in a new or existing script :
1. From a new or existing script, select Variable Check from the IF drop-down.
2. Enter LTSG_FunctionName in the Test the Variable field.
3. Select Exists from the Compare drop-down.
4. Leave the To field blank for this example.
5. Click Save to save this step and close the window.
142
CHAPTER 2
Computer Functions
This chapter provides parameter information, as well as examples for the various computer functions available within LabTech.
Bulk Registry Write
144
Computer Functions
147
Disk Check
148
Disk Cleanup
150
Disk Defrag
152
Performance Counter Get
154
Printer Clear Queue
156
Printer Set Default
158
Process Execute
160
Process Execute As Admin
163
Process Execute As User
165
Process Kill
168
Registry Delete Key
170
Registry Set Value
173
Service Start
180
ServiceStartup Control
182
Service Stop
184
Share Create
186
Share Delete
188
Bulk Registry Write
Performs a bulk import of registry keys. It starts at the registry key and splits the name value pairs
by a pipe (|) and sets those names to values. This function runs on the agent.
Parameters
o
Registry Key:The base registry key to start writing values at. If the key does not exist, it will
be created.
Name Value Pairs: Parameters consists of value/data pair(s) separated by pipe character
(s). The name value pairs are assigned to registry value/data pairs.
o
REG_SZ data is a string. Only 7 bit ASCII characters are allowed. Default type,
no prefix required. Example value/data pair:String1=Thank You for using
LabTech!
REG_MULTI_SZ data is a comma-delimited list of strings. Add "-lt-m" prefix to
data. Example value/data pair: MultiString1=-lt-mFirst Entry, Second Entry,
Third Entry
REG_BINARY, an 8 bit integer, data is a comma-delimited list of hexidecimal values. Add "-lt-b" prefix to data. Example value/data pair: BinaryValue1=-ltb41,61,62,54,65,63,68,21
REG_DWORD, a 32 bit integer (0 to 4,294,967,295), data can be a base 10
integer or hexidecimal (prepend 0x) value. Add "-lt-q" prefix to data. Example
value/data pairs: DWordValue1=-lt-i0|DWordValue2=-lti4294967295|DWordValue3=-lt-i0xffffffff
REG_QWORD, a 64 bit integer (0 to 18,226,744,073,709,551,615), data can be
a base 10 integer or hexidecimal (prepend 0x) value. Add "-lt-q" prefix to data.
Example egistry WriteRvalue/data pairs: QWordValue1=-lt-q0|QWordValue2=lt-q18226744073709551615|QWordValue3=-lt-q0xfffffffffffffff
Examples
Example #1: Writes REG_SZ, REG_MULTI_SZ, REG_BINARY, REG_DWORD AND REG_
QWORD data to the registry of the agent computer.
Parameters:
o
Registry Key: HKCU\Software\LabTech\LTSG\
Name Value Pairs:String=Prepare to be Automated!|MultiString=-lt-mLabTech,Prepare,Be Automated|BinaryValue1=-ltb50,72,65,70,61,72,65,20,74,6f,20,42,65,20,41,75,74,6f,6d,61,74,65,64,21|DWordValue1-
144
=-lt-i0|DWordValue2=-lt-i4294967295|DWordValue3=-lt-i0xffffffff|QWordValue1=-ltq0|QWordValue2=-lt-q18226744073709551615|QWordValue3=-lt-q0xfffffffffffffff
Example Name Value Pairs and Type
Name Value Pair
Type
String=Prepare to be Automated!
REG_SZ
MultiString=-lt-mLabTech,Prepare,Be Automated
REG_MULTI_SZ
BinaryValue1=-ltb50,72,65,70,61,72,65,20,74,6f,20,42,65,
20,41,75,74,6f,6d,61,74,65,64,21
REG_BINARY
DWordValue1=-lt-i0
REG_DWORD
DWordValue2=-lt-i4294967295
REG_DWORD
DWordValue3=-lt-i0xffffffff
REG_DWORD
QWordValue1=-lt-q0
REG_QWORD
QWordValue2=-lt-q18226744073709551615
REG_QWORD
QWordValue3=-lt-q0xfffffffffffffff
REG_QWORD
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Bulk Registry Write from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG\ into the Registry Key field.
4. Enter String=Prepare to be Automated!|MultiString=-lt-mLabTech,Prepare,Be Automated|BinaryValue1=-ltb50,72,65,70,61,72,65,20,74,6f,20,42,65,20,41,75,74,6f,6d,61,74,65,64,21|DWordValue1=-lt-i0|DWordValue2=-lt-i4294967295|DWordValue3=-lt-i0xffffffff|QWordValue1=-ltq0|QWordValue2=-lt-q18226744073709551615|Q2WordValue3=-lt-q0xfffffffffffffff into
the Name Value Pairs field.
5. Click Save Step to save this step and close the window.
146
Computer Functions
This chapter provides parameter information, as well as examples for the various computer functions available
within LabTech.
Disk Check
Runs chkdsk on a drive and uses the variable @=computerid@= for the target computer. This function runs on the agent.
Parameters
o
Drive Letter:Drive letter to scan, leave blank for all drives.
Result Variable: Name of variable to store result (entered without the @ signs (e.g.,
DiskCheckResultsDriveC)
Examples
Example #1: Performs a disk check on the C: drive and saves the result to @DiskCheckResultsDriveC@
Parameters:
o
Drive Letter:C
Result Variable: DiskCheckResultsDriveC
Example #2: Performs a disk check on all drives and saves the result to @DiskCheckResultsAllDrives@
Parameters:
o
Drive Letter:
Result Variable: DiskCheckResultsAllDrives
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Disk Check from the Function drop-down.
3. Enter C (or leave blank for all drives) into the Drive Letter field.
4. Enter DiskCheckResultsDriveC (or DiskCheckResultsAllDrives if scanning all drives)
into the Result Variable field.
5. Click Save Step to save this step and close the window.
148
Disk Cleanup
Runs the internal LabTech disk cleanup according to the settings in the configuration (Dashboard
>Configurations > Disk Cleanup)and uses the variable @computerid@ for the target computer. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Performs a disk cleanup on the targeted computer
Parameters:
o
None
Using the function in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Disk Cleanup from the Function drop-down.
3. Click Save Step to save this step and close the window.
150
Disk Defrag
Defragments the specified drive and uses the variable @=computerid@= for the target computer.
This function runs on the agent.
Parameters
o
Drive Letter:Drive letter to defragment, leave blank for all drives
Result Variable: Name of variable to store result (entered without the @ signs (e.g.,
DefragResultsDriveC)
Examples
Example #1: Defragments drive C: and saves the result to @DefragResultsDriveC@.
Parameters:
o
Drive Letter:C
Result Variable: DefragResultsDriveC
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Disk Defrag from the Function drop-down.
3. Enter C into the Drive Letter field.
4. Enter DefragResultsDriveC into the Result Variable field.
5. Click Save Step to save this step and close the window.
152
Performance Counter Get
Reads performance counter and saves the result to a variable and uses performance monitor to
obtain category and counter names. This function runs on the agent.
Parameters
o
Category:The performance counter category
Counter: The performance counter
Instance: The performance counter instance, leave blank for multiple instances
Result Variable:Save results to this variable, without @ signs
Examples
Example #1: Reads the Performance Counter physical disk/avg disk sec/read
Parameters:
o
Category:Physical Disk
Counter: Avg. Disk sec/read
Instance: 0 C:
Result Variable:AvgDiskRead
Using the function example #1 in a new or existing script :
1. Right-click a line in the Then or Else section, select Add to open the Edit Script Step window.
2. Select Bulk Registry Write from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG\ into the Registry Key field.
4. Enter String=Prepare to be Automated!|MultiString=-lt-mLabTech,Prepare,Be Automated|BinaryValue1=-ltb50,72,65,70,61,72,65,20,74,6f,20,42,65,20,41,75,74,6f,6d,61,74,65,64,21|DWordValue1=-lt-i0|DWordValue2=-lt-i4294967295|DWordValue3=-lt-i0xffffffff|QWordValue1=-ltq0|QWordValue2=-lt-q18226744073709551615|Q2WordValue3=-lt-q0xfffffffffffffff into
the Name Value Pairs field.
5. Click Save Step to save this step and close the window.
Example #2: Reads the performance counter Memory pages input/sec
Parameters:
154
Category:Memory
Counter: Pages Input/sec
Instance:
Result Variable:PagesInputPerSec
Example #3: Reads the performance counter Paging File % Usage Peak
Parameters:
o
Category:Paging File
Counter: %User Peak
Instance: _Total
Result Variable:PercentUsagePeak
Example #4: Reads the performance counter Process %Processor Time
Parameters:
o
Category:Process
Counter: %Processor Time
Instance: Idle
Result Variable:PercentPrivilegedTime
Printer Clear Queue
Clears the printer queue. This function runs on the agent.
Parameters
o
Printer Name:Requires the exact name of the printer in LabTech.
Examples
Example #1: Clears the printer queue for a specific printer.
Parameters:
o
Printer Name: Microsoft XPSDocument Writer
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Printer Clear Queue from the Function drop-down.
3. Enter Microsoft XPSDocument Writer into the Printer Name field.
4. Click Save Step to save this step and close the window.
156
Printer Set Default
Sets the default printer on the remote computer. This function runs on the agent.
Parameters
o
Printer Name:Requires the exact name of the printer in LabTech.
Examples
Example #1: Sets the default printer on the remote computer.
Parameters:
o
Printer Name:Microsoft XPSDocument Writer
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Printer Set Default from the Function drop-down.
3. Enter Microsoft XPSDocument Writer into the Printer Name field.
4. Click Save Step to save this step and close the window.
158
Process Execute
Runs program in background on remote computer in the context of the LabTech agent. Program is
launched in a manner similar to starting from the Start >Run dialog in Windows. This function
runs on the agent.
NOTE: Guarding Process is a LabTech feature that cleans up script steps that fail to terminate
properly. By default the guarding process will end a script step with 0% CPU utilization after five
minutes. When running an external process that will run for more than five minutes, this feature
can be disabled in the Process Execute functions by appending an exclamation point (!) to the end
of the Arguments parameter. Disabling the Guarding Process would be required, for example; if
a scan process that will take more that 5 minutes is launched using Cmd.exe. If the Guarding Process is not disabled, the Script Engine will cleanup the step because Cmd.exe has 0% CPU utilization. The script would then proceed to the next step before the scan process has written scan
results to a log file. Disabling the Guarding Process would prevent these actions and ensure that
the scan log file is available to be parsed by the next step.
IMPORTANT: If the process fails to terminate while the Guarding Process is disabled, it will be
necessary to manually delete the script on the Scripts tab of the Computer Management
screen.
Parameters
o
File:Full path to executable
Arguments: Parameters to pass to the executable
When to Return:Select when to return from drop-down menu (Wait for Process or Return
Immediately)
Examples
Example #1: Runs a program in the background to demonstrate the process is running in the context of the LabTech agent.
Parameters:
o
File:c:\windows\system32\cscript.exe
Arguments: //nologo c:\windows\temp\LTSG_TestProcessExecute.vbs
When to Return:Wait for Process
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
160
2. Select Process Execute from the Function drop-down.
3. Enter c:\windows\system32\cscript.exe into the File field.
4. Enter //nologo c:\windows\temp\LTSG_TestProcessExecute.vbs into the Arguments
field.
5. Select Wait for Process from the When to Return drop-down.
6. Click Save Step to save this step and close the window.
Example #2: Runs a process in the background with the Guarding Process disabled.
Parameters:
o
File:c:\windows\system32\cscript.exe
Arguments: //nologo c:\windows\temp\LTSG_TestProcessExecute.vbs!
When to Return:Wait for Process
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Process Execute from the Function drop-down.
3. Enter c:\windows\system32\cscript.exe into the File field.
4. Enter //nologo c:\windows\temp\LTSG_TestProcessExecute.vbs! into the Arguments field.
5. Select Wait for Process from the When to Return drop-down.
6. Click Save Step to save this step and close the window.
162
Process Execute As Admin
Runs program in background as the Administrator account defined for this location on the remote
computer. This function runs on the agent.
NOTE: Guarding Process is a LabTech feature that cleans up script steps that fail to terminate
properly. By default the guarding process will end a script step with 0% CPU utilization after five
minutes. When running an external process that will run for more than five minutes, this feature
can be disabled in the Process Execute functions by appending an exclamation point (!) to the end
of the Arguments parameter. Disabling the Guarding Process would be required, for example; if
a scan process that will take more that 5 minutes is launched using Cmd.exe. If the Guarding Process is not disabled, the Script Engine will cleanup the step because Cmd.exe has 0% CPU utilization. The script would then proceed to the next step before the scan process has written scan
results to a log file. Disabling the Guarding Process would prevent these actions and ensure that
the scan log file is available to be parsed by the next step.
IMPORTANT: If the process fails to terminate while the Guarding Process is disabled, it will be
necessary to manually delete the script on the Scripts tab of the Computer Management
screen.
Parameters
o
File:Full path to executable
Arguments: Parameters to pass to the executable
When to Return:Select when to return from drop-down menu (Wait for Process or Return
Immediately)
Example
Example #1: Runs a program in the background to demonstrate the process is running as the
Administrator account.
Parameters:
o
File:c:\windows\system32\cscript.exe
Arguments: //nologo c:\windows\temp\LTSG_TestProcessExecute.vbs
When to Return:Wait for Process
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Process Execute as Admin from the Function drop-down.
3. Enter c:\windows\system32\cscript.exe into the File field.
4. Enter //nologo c:\windows\temp\LTSG_TestProcessExecute.vbs into the Arguments
field.
5. Select Wait for Process from the When to Return drop-down.
6. Click Save Step to save this step and close the window.
164
Process Execute As User
Runs program in background as the specified Windows user defined in the Username parameter. This function runs on the agent.
NOTE: Guarding Process is a LabTech feature that cleans up script steps that fail to terminate
properly. By default the guarding process will end a script step with 0% CPU utilization after five
minutes. When running an external process that will run for more than five minutes, this feature
can be disabled in the Process Execute functions by appending an exclamation point (!) to the end
of the Arguments parameter. Disabling the Guarding Process would be required, for example; if
a scan process that will take more that 5 minutes is launched using Cmd.exe. If the Guarding Process is not disabled, the Script Engine will cleanup the step because Cmd.exe has 0% CPU utilization. The script would then proceed to the next step before the scan process has written scan
results to a log file. Disabling the Guarding Process would prevent these actions and ensure that
the scan log file is available to be parsed by the next step.
IMPORTANT: If the process fails to terminate while the Guarding Process is disabled, it will be
necessary to manually delete the script on the Scripts tab of the Computer Management
screen.
Parameters
o
File:Full path to executable
Arguments: Parameters to pass to the executable
When to Return:Select when to return from drop-down menu (Wait for Process or Return
Immediately)
Username: The username to run this process as. Enter either a username or domain/username
Password: The password associated with this username
Examples
Example #1: Runs a program in the background to demonstrate the process is running as the user
account.
Parameters:
o
File:c:\windows\system32\cscript.exe
Arguments: //nologo c:\windows\temp\LTSG_TestProcessExecute.vbs
When to Return:Wait for Process
Username: @UserName@
Password:@Password@
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Process Execute as User from the Function drop-down.
3. Enter c:\windows\system32\cscript.exe into the File field.
4. Enter //nologo c:\windows\temp\LTSG_TestProcessExecute.vbs into the Arguments
field.
5. Select Wait for Process from the When to Return drop-down.
6. Enter @UserName@ in the Username field.
7. Enter @Password@ in the Password field.
8. Click Save Step to save this step and close the window.
166
Process Kill
Ends a process on the remote computer. This function runs on the agent.
Parameters
o
Process Name:The process name or process number to end
Examples
Example #1: Terminates Notepad.
Parameters:
o
Process Name:Notepad
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Process Kill from the Function drop-down.
3. Enter Notepad into the Process Name field.
4. Click Save Step to save this step and close the window.
168
Registry Delete Key
Deletes a registry key or value from the registry. This function runs on the agent.
Parameters
o
Registry Key:The key or value to be deleted. To delete a value, append the value name to
the full key path with backslash (e.g., HKCU\Software\LabTech\key\value).To delete a key,
end the parameter with a backslash after the full key path (e.g., HKCU\Software\LabTech\key\).
Examples
Example #1: Deletes a registry value from the registry.
Parameters:
o
Registry Key:HKCU\Software\LabTech\LTSG\String1
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Registry Delete Key from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG\String1 into the Registry Key field.
4. Click Save Step to save this step and close the window.
170
Example #2: Deletes a registry key from the registry.
Parameters:
o
Registry Key:HKCU\Software\LabTech\LTSG
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Registry Delete Key from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG into the Registry Key field.
4. Click Save Step to save this step and close the window.
172
Registry Set Value
Writes a registry value to the registry. This function runs on the agent.
Parameters
o
Registry Value:Registry value to change. Appends the value name to the full key path with
a backslash.
Data: Data to write.
REG_SZ data is a string. Only 7 bit ASCII characters are allowed. Example
string data: Thank You for using LabTech!
REG_MULTI_SZ data is a comma-delimited list of strings. Example MultiString
data:First Entry, Second Entry, Third Entry
REG_BINARY, an 8 bit integer,data is a comma-delimited list of hexidecimal
(prepend 0x) value. Example Binary data: 4c, 61,62,54,65,63,68,21
REG_DWORD, a 32 bit integer (0 to 4,294,967,295), data can be a base 10
integer or hexidecimal (prepend 0x) value.Example DWord data: 0, 2147483647
or 0xffffffff
Data Type: Select Registry Data Type from drop-down menu. (Reg_sz, Reg_binary,
Reg_dword, Reg_Multi_sz)
Examples
Example #1: Writes REG_SZ data to the registry of the agent computer.
Parameters:
o
Registry Value:HKCU\Software\LabTech\LTSG\String1
Data: Prepare to Be Automated!
Data Type:Reg_sz
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Registry Set Value from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG\String1 into the Registry Value field.
4. Enter Prepare to Be Automated! into the Data field.
5. Select Reg_sz from the Data Type drop-down.
6. Click Save Step to save this step and close the window.
Example #2: Writes REG_MULTI_SZ data to the registry of the agent computer.
Parameters:
o
Registry Value:HKCU\Software\LabTech\LTSG\MultiString1
Data: LabTech,Prepare,Be Automated
Data Type:Reg_Multi_sz
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Registry Set Value from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG\MultiString1 into the Registry Value field.
4. Enter LabTech,Prepare,Be Automated into the Data field.
174
5. Select Reg_Multi_sz from the Data Type drop-down.
6. Click Save Step to save this step and close the window.
Example #3: Writes REG_BINARY data to the registry of the agent computer.
Parameters:
o
Registry Value:HKCU\Software\LabTech\LTSG\Binary1
Data: 50,72,65,70,61,72,65,20,74,6f,20,42,65,20,41,75,74,6f,6d,74,65,64,21
Data Type:Reg_binary
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Registry Set Value from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG\Binary1 into the Registry Value field.
4. Enter 50,72,65,70,61,72,65,20,74,6f,20,42,65,20,41,75,74,6f,6d,74,65,64,21 into the Data
field.
5. Select Reg_binary from the Data Type drop-down.
6. Click Save Step to save this step and close the window.
Example #4: Writes REG_DWORD data to the registry of the agent computer.
Parameters:
o
Registry Value:HKCU\Software\LabTech\LTSG\DWord1
Data: 0
Data Type:Reg_dword
Registry Value:HKCU\Software\LabTech\LTSG\DWord2
Data: 4294967295
Data Type:Reg_dword
176
Registry Value:HKCU\Software\LabTech\LTSG\DWord5
Data: 0xffffffff
Data Type:Reg_dword
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Registry Set Value from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG\DWord1 into the Registry Value field.
4. Enter 0 into the Data field.
5. Select Reg_dword from the Data Type drop-down.
6. Click Save Step to save this step and close the window.
7. Right-click a line in the Then or Else section, select Add to open the Edit Script Step window.
8. Select Registry Set Value from the Function drop-down.
9. Enter HKCU\Software\LabTech\LTSG\DWord2 into the Registry Value field.
10. Enter 4294967295 into the Data field.
11. Select Reg_dword from the Data Type drop-down.
12. Click Save Step to save this step and close the window.
13. Right-click a line in the Then or Else section, select Add to open the Edit Script Step window.
14. Select Registry Set Value from the Function drop-down.
15. Enter HKCU\Software\LabTech\LTSG\DWord3 into the Registry Value field.
16. Enter 0xffffffff into the Data field.
17. Select Reg_dword from the Data Type drop-down.
18. Click Save Step to save this step and close the window.
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Registry Set Value from the Function drop-down.
3. Enter HKCU\Software\LabTech\LTSG\DWord1 into the Registry Value field.
4. Enter 0 into the Data field.
5. Select Reg_dword from the Data Type drop-down.
6. Click Save Step to save this step and close the window.
7. Right-click a line in the Then or Else section, select Add to open the Edit Script Step window.
8. Select Registry Set Value from the Function drop-down.
9. Enter HKCU\Software\LabTech\LTSG\DWord2 into the Registry Value field.
10. Enter 4294967295 into the Data field.
11. Select Reg_dword from the Data Type drop-down.
12. Click Save Step to save this step and close the window.
13. Right-click a line in the Then or Else section, select Add to open the Edit Script Step window.
14. Select Registry Set Value from the Function drop-down.
15. Enter HKCU\Software\LabTech\LTSG\DWord3 into the Registry Value field.
16. Enter 0xffffffff into the Data field.
17. Select Reg_dword from the Data Type drop-down.
18. Click Save Step to save this step and close the window.
178
Service Start
Starts a Windows service. This function runs on the agent.
Parameters
o
Service Name:Name of the service
Examples
Example #1: Starts the Print Spooler service, resends the service list and writes an entry to the
script log.
Parameters:
o
Service Name:Spooler
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Service Start from the Function drop-down.
3. Enter Spooler into the Service Name field.
4. Click Save Step to save this step and close the window.
180
ServiceStartup Control
Sets the service startup mode. This function runs on the agent.
Parameters
o
Service Name:Name of the service
Mode:Select the desired mode from the drop-down (AutoStart, Manual, Disabled)
Examples
Example #1: Configures the Print Spooler service to start automatically
Parameters:
o
Service Name:Spooler
Mode: AutoStart
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Service Start Control from the Function drop-down.
3. Enter Spooler into the Service Name field.
4. Enter AutoStart into the Mode field.
5. Click Save Step to save this step and close the window.
182
Service Stop
Stops a Windows service. This function runs on the agent.
Parameters
o
Service Name:Name of the service
Examples
Example #1: Stops the Print Spooler service, resends the service list and writes an entry to the
script log.
Service Stop Function
Parameters:
o
Service Name:Spooler
Resend Service List Function
Parameters:
o
None
Script Log Message Function
Parameters:
o
Message: Successfully stopped Spooler service.
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Service Stopl from the Function drop-down.
3. Enter Spooler into the Service Name field.
4. Enter AutoStart into the Mode field.
5. Click Save Step to save this step and close the window.
6. Right-click the next line below the step containing the function you just added in the Then or
Else section, select Add to open the Edit Script Step window.
7. Select Resend Service List from the Function drop-down.
8. Click Save Step to save this step and close the window.
184
9. Right-click the next line below the step containing the resend service list function you just
added in the Then or Else section, select Add to open the Edit Script Step window.
10. Select Script Log function from the Function drop-down.
11. Enter Successfully stopped spooler service. into the Message field.
12. Click Save Step to save this step and close the window.
Share Create
Shares a folder on the remote agent. This function runs on the agent.
Parameters
o
Directory Path:Full path to the directory to share
Share Name: Name of the share
Examples
Example #1: Creates a network share on the remote agent using the Folder Create and Share
Create functions.
Folder Create function
Parameters:
o
Folder: c:\LabTech_LTSG\Archive
Share Create function
Parameters:
o
Directory Path: c:\LabTech_LTSG\Archive
Share Name: LTSGArchive
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Share Create from the Function drop-down.
3. Enter c:\LabTech_LTSG\Archive into the Directory Path field.
4. Enter LTSGArchive into the Share Name field.
5. Click Save Step to save this step and close the window.
186
Share Delete
Deletes a network share on the remote computer. This function runs on the agent.
Parameters
o
Share Name: Name of the share
Examples
Example #1: Removes a network share from the remote computer.
Parameters:
o
Share Name: LTSGArchive
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Share Create from the Function drop-down.
3. Enter LTSGArchive into the Share Name field.
4. Click Save Step to save this step and close the window.
188
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
190
CHAPTER 3
Computer State Functions
This chapter provides parameter information, as well as examples for the various computer state
functions available within LabTech.
Hibernate
192
Reboot
193
Reboot Forced
194
Reboot to Cmd Prompt
195
Reboot to Safe Mode
196
Suspend
197
Hibernate
Hibernates the computer if it supports this function. No warning will be given to the user, the command will return immediately. This function runs on the agent.
Parameters
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Hibernate from the Function drop-down.
3. Click Save Step to save this step and close the window.
192
Reboot
Reboots the computer using the LabTech agent template settings associated with the agent. The
user prompt that the user will see (if any)is also defined in the agent template. Use @computerid@
to target a computer. This command returns immediately. This function runs on the agent.
Parameters
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Reboot from the Function drop-down.
3. Click Save Step to save this step and close the window.
Reboot Forced
Issues a reboot command to the computer that bypasses all user prompting and template settings.
The command gives the user 60 seconds to close applications and then restarts the computer forcing any hung applications to close. The user cannot abort this reboot! This command returns
immediately. This function runs on the agent.
Parameters
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Reboot forced from the Function drop-down.
3. Click Save Step to save this step and close the window.
194
Reboot to Cmd Prompt
Reboots the computer to safe mode with only a command prompt as the shell. Use @computerid@ to target a computer. The prompt the user receives is defined by the agent template settings. This command returns immediately. This function runs on the agent.
Parameters
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Reboot to Cmd Prompt from the Function drop-down.
3. Click Save Step to save this step and close the window.
Reboot to Safe Mode
Reboots the computer to safe mode. Use @computerid@ to target a computer. The prompt the
user receives is defined by the agent template settings. This command returns immediately. This
function runs on the agent.
Parameters
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Reboot to Safemode from the Function drop-down.
3. Click Save Step to save this step and close the window.
196
Suspend
Suspends the computer if it supports this function. No warning will be given to the user, the command will return immediately. This function runs on the agent.
Parameters
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Suspend from the Function drop-down.
3. Click Save Step to save this step and close the window.
CHAPTER 3
ContactFunctions
This chapter provides parameter information, as well as examples for the contact functions available within
LabTech.
ContactFunctions
198
Index of Topics in Contact Functions
198
Contact - Script for Each
198
ContactFunctions
This chapter provides parameter information, as well as examples for the contact functions available within
LabTech.
Index of Topics in Contact Functions
Delete this text and replace it with your own content.
n
Contact - Script for Each
Contact - Script for Each
Runs a script on each computer associated with the contact.
Parameters
o
Script To Run: Choose script to run from the drop-down menu for each variable in the list.
(List of Scripts retrieved from database.)
Examples
Example #1: This example runs 'Get Product Keys' script on each computer associated with a contact.
Parameters:
o
Script To Run: _System Automation\Product Keys\Get Product Keys
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Script for Each from the Function drop-down.
3. Select _System Automation\Product Keys\Get Product Keys from the Script To Run
drop-down.
198
4. Click Save Step to save this step and close the window.
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
200
CHAPTER 4
DatabaseFunctions
This chapter provides parameter information, as well as examples for the various database
functions available within LabTech.
ExtraData Get Value
202
ExtraData Set Value
204
Script State Clear
206
Script State Get
208
Script State Set
211
Script Stats Clear
214
Script Stats Get
216
Script Stats Save
218
SQLExecute
220
SQL Fetch DataSet Row
224
SQLGet DataSet
228
SQLGet Value
232
Template Property Get Value
236
ExtraData Get Value
Reads an extra data field and saves it to a variable. The field ends with the type of IDneeded (1=coomputerid, 2=locationid, 3=clientid, 4=probeid, 5=deviceid, 6=ticketid, 7=groupid. This function
runs on the server.
Parameters
o
Extra Field: Select from the available extra data fields retrieved from the database using the
drop-down.
ID: Enter the IDtype (e.g.,@computerid@). Make sure to enclose in @ signs.
Value: Enter a variable to put the results in, without the @ signs
Examples
Example #1: Assigns the contents of the Enable Ticket Policy-2 extra data field to the TicketPolicy
variable.
Parameters:
o
Extra Field: Enable Ticket Policy-2
ID: @computerid@
Value: TicketPolicy
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select ExtraData Get Value from the Function drop-down.
3. Select Enable Ticket Policy-2 from the Extra Field drop-down.
4. Enter @computerid@ into the ID field.
5. Enter TicketPolicy into the Value field.
6. Click Save Step to save this step and close the window.
202
ExtraData Set Value
Sets an extra data field from a variable. The field ends with the type of IDneeded (1=computerid,
2=locationid, 3=clientid, 4=probeid, 5=deviceid, 6=ticketid, 7=groupid. This function runs on the
server.
Parameters
o
Extra Field: Select from the available extra data fields retrieved from the database using the
drop-down.
ID: Enter the IDtype (e.g.,@computerid@). Make sure to enclose in @ signs.
Value: Data to assign to the extra data field. If specifying a variable, include the @ signs.
Examples
Example #1: Sets the value of the Manager Email-2 EDFto [email protected].
Parameters:
o
Extra Field: Manager Email-2
ID: @locationid@
Value: [email protected]
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select ExtraData Set Value from the Function drop-down.
3. Select Manager Email-2 from the Extra Field drop-down.
4. Enter @locationid@ into the ID field.
5. Enter
[email protected] into the Value field.
6. Click Save Step to save this step and close the window.
204
Script State Clear
Clears the script variable for this script. This function runs on the server.
Parameters
o
ComputerID: Computer to clear the state on, use computerid with % signs if operation is performed on local computer or with @ signs for a remote computer.
Examples
Example #1: Clears the script state on the local computer.
Parameters:
o
ComputerID: %computerid%
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select ExtraData Set Value from the Function drop-down.
3. Enter %computerid% into the ComputerID field.
4. Click Save Step to save this step and close the window.
206
Script State Get
Loads a variable from the script state. This function runs on the server.
Parameters
o
ComputerID: Computer to load state for, use computerid with % signs if operation is performed on local computer or with @ signs for a remote computer.
Name: Name of the variable to save, without @signs. Leave empty to load all script variables.
Variable: Save results to this variable, without @ signs. Ignored when loading all variables.
Examples
Example #1: Retrieves the date, script was last run on the local computer.
Parameters:
o
ComputerID: %computerid%
Name: DateLastRunVar
Variable: DateLastRun
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script State Get from the Function drop-down.
3. Enter %computerid% into the ComputerID field.
4. Enter DateLastRunVar into the Name field.
5. Enter DateLastRun into the Variable field.
6. Click Save Step to save this step and close the window.
208
Example #2: Saves all script variables on the local computer.
Parameters:
o
ComputerID: %computerid%
Name:
Variable: AllStateVars
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script State Get from the Function drop-down.
3. Enter %computerid% into the ComputerID field.
4. Leave the Name field blank.
5. Enter DateLastRun into the Variable field.
6. Click Save Step to save this step and close the window.
210
Script State Set
Saves a variable to the script state to use later. Script state is unique for every script and computer.
This function runs on the server.
Parameters
o
ComputerID: Computer to load state for, use computerid with % signs if operation is performed on local computer or with @ signs for a remote computer.
Name: Name of the variable to save, without @signs. Leave empty to save all script variables.
Value: Value to save to the variable, with @ signs. Ignored when loading all variables.
Examples
Example #1: Saves the date script was last run on the local computer.
Variable Set function
Parameters:
o
Set Type: SQLQuery
Parameter: SELECT CURRENT_DATE;
Variable Name: TodaysDate
Script State function
Parameters:
o
ComputerID: %computerid%
Name: DateLastRunVar
Value: @TodaysDate@
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select SQL Query from the Set Type drop-down.
4. Enter SELECT CURRENT_DATE; into the Parameter field.
5. Enter TodaysDate into the Variable Name field.
6. Click Save Step to save this step and close the window.
7. Right-click a line in the Then or Else section, select Add to open the Edit Script Step window.
8. Select Script State Set from the Function drop-down.
9. Enter %computerid% into the ComputerID field.
10. Enter DateLastRunVar into the Name field.
11. Enter @TodaysDate@ into the Value field.
12. Click Save Step to save this step and close the window.
Example #2: Saves all script variables on the local computer.
Parameters:
o
ComputerID: %computerid%
Name:
Value:
212
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script State Set from the Function drop-down.
3. Enter %computerid% into the ComputerID field.
4. Leave the Name field blank.
5. Leave the Value field blank.
6. Click Save Step to save this step and close the window.
Script Stats Clear
Clears the script stats for the computer specified. This function runs on the server.
Parameters
o
ComputerID: Computer to clear stat for, use computerid with % signs if operation is performed on local computer or with @ signs for a remote computer.
Name:Name of the stat to clear, without @ signs. Leave blank to clear all stats.
Examples
Example #1: Clears the ScriptRunCountStat computer stat on the local computer.
Parameters:
o
ComputerID: %computerid%
Name:ScriptRunCountStat
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Stats Clear from the Function drop-down.
3. Enter %computerid% into the ComputerID field.
4. Enter ScriptRunCountStat into the Name field.
5. Click Save Step to save this step and close the window.
214
Script Stats Get
Gets the script status counter for the specified computer. This function runs on the server.
Parameters
o
ComputerID: Computer to load stat for, use computerid with % signs if operation is performed on local computer or with @ signs for a remote computer.
Name:Name of the variable to load, without @ signs
Variable:Save results to this variable, without @ signs
Examples
Example #1: Assigns the value of the ScriptRunCountStat to the ScriptRunCount variable.
Parameters:
o
ComputerID: %computerid%
Name:ScriptRunCountStat
Variable:ScriptRunCount
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Stats Get from the Function drop-down.
3. Enter %computerid% into the ComputerID field.
4. Enter ScriptRunCountStat into the Name field.
5. Enter ScriptRunCount into the Variable field.
6. Click Save Step to save this step and close the window.
216
Script Stats Save
Adds 1 to the script stat counter for the computer specified. This function runs on the server.
Parameters
o
ComputerID: Computer to save stat for, use computerid with % signs if operation is performed on local computer or with @ signs for a remote computer.
Name:Name of the stat to save, without @ signs
Examples
Example #1: Increments the ScriptCountStat computer stat on the local computer.
Parameters:
o
ComputerID: %computerid%
Name:ScriptRunCountStat
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Stats Get from the Function drop-down.
3. Enter %computerid% into the ComputerID field.
4. Enter ScriptRunCountStat into the Name field.
5. Click Save Step to save this step and close the window.
218
SQLExecute
Runs a SQLstatement. This function runs on the server.
Parameters
o
SQLStatement: The SQLstatement to run.
ODBC Connection:The ODBC connection to the database or leave blank to use the
LabTech database.
Examples
Example #1: Creates a temporary table in the LabTech database.
Parameters:
o
SQLStatement: CREATE TEMPORARY TABLE localcomputers SELECT computerid,
NAME, domain FROM computers WHERE locationid = %locationid%;
ODBC Connection:
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLExecute from the Function drop-down.
3. Enter CREATE TEMPORARY TABLE localcomputers SELECT computerid, NAME,
domain FROM computers WHERE locationid = %locationid%; into the
SQLStatement field.
4. Leave the ODBC Connection field blank.
5. Click Save Step to save this step and close the window.
220
Example #2: Creates a temporary table in an external database, username and password is
included in ODBC.
Parameters:
o
SQLStatement: CREATE TEMPORARY TABLE temptable SELECT id, name, address
FROM table1;
ODBC Connection:DSN=myDSN;UID=myUsername;Pwd=myPassword;
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLExecute from the Function drop-down.
3. Enter CREATE TEMPORARY TABLE temptable SELECT id, name, address FROM
table1; into the SQLStatement field.
4. Enter DSN=myDSN;UID=myUsername;Pwd=myPassword; into the ODBC Connection field. (Replace with valid external DB and credentials. Example is given to illustrate
syntax)
5. Click Save Step to save this step and close the window.
Example #3: Creates a temporary table in an external database, username and password is not
included in ODBC.
Parameters:
o
SQLStatement: CREATE TEMPORARY TABLE localcomputers SELECT computerid,
NAME, domain FROM computers WHERE locationid = %locationid%;
ODBC Connection:DSN=myDSN;
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
222
2. Select SQLExecute from the Function drop-down.
3. Enter CREATE TEMPORARY TABLE temptable SELECT id, name, address FROM
table1; into the SQLStatement field.
4. Enter DSN=myDSN; into the ODBC Connection field. (Replace with valid external DB.
Example is given to illustrate syntax)
5. Click Save Step to save this step and close the window.
SQL Fetch DataSet Row
Gets the row ofthe DataSet (starting at row 1) and stores the value of each column in a variable referenced by the column name (e.g., @sqlCOLUMNNAME@). This function runs on the server.
Parameters
o
SQLDataSet: The SQLstatement to run.
Row to Fetch: Enter the row of the dataset to use.
Examples
Example #1: Returns the computer ID, computer name and operating system of the computers at
a given location, retrieved from the LabTech database.
SQLGetDataSet function
Parameters:
o
SQLStatement: SELECT `ComputerID`,`Name`,`OS`,'1' AS Query FROM `LabTech`.`computers` WHERE `ClientID` = %clientid% AND `LocationID` = %locationid% ;
ODBC Connection:
Script Log Message function
Parameters:
o
Message: Number of rows retrieved from database:%sqldatasetrowcount%
Variable Set function
Parameters:
o
Set Type: Constant
Parameter:1
Variable Name:cnt
Variable Check function
Parameters:
o
Variable Name: @cnt@
Parameter:>
224
To: %sqldatasetrowcount%
Steps to Skip::EndComputerList
SQLFetch DataSet Row Function
Parameters:
o
SQLDataSet: sqldataset
Row to Fetch: @cnt@
Script Goto Function
Parameters:
o
Steps to Skip: :ComputerList
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLGetDataSet from the Function drop-down.
3. Enter SELECT `ComputerID`,`Name`,`OS`,'1' AS Query FROM `LabTech`.`computers` WHERE `ClientID` = %clientid% AND `LocationID` = %locationid% ;t
into the SQLStatement field.
4. Leave the ODBC Connection field blank.
5. Click Save Step to save this step and close the window.
6. Right-click the next line , select Add to open the Edit Script Step window.
7. Select Script Log Message from the Function drop-down.
8. Enter Number of rows retrieved from database:%sqldatasetrowcount% into the
message field.
9. Click Save Step to save this step and close the window.
10. Right-click the next line , select Add to open the Edit Script Step window.
11. Select Variable Set from the Function drop-down.
12. Enter Constant into the Set Type field.
13. Enter 1 into the Parameter field.
14. Enter cnt into the Variable Name field.
15. Click Save Step to save this step and close the window.
16. Right-click the next line , select Add to open the Edit Script Step window.
17. Select Variable Check from the Function drop-down.
18. Enter @cnt@ into the Variable Name field.
19. Enter > into the Parameter field.
20. Enter %sqldatasetrowcount% into the To field.
21. Enter :EndComputerList into the Steps to Skip field.
22. Click Save Step to save this step and close the window.
23. Right-click the next line , select Add to open the Edit Script Step window.
24. Select SQL DataSet Row from the Function drop-down.
25. Enter sqldataset into the SQL Dataset field.
26. Enter Row to Fetch into the @cnt@ field.
27. Click Save Step to save this step and close the window.
28. Right-click the next line , select Add to open the Edit Script Step window.
29. Select Script Goto from the Function drop-down.
30. Enter :ComputerList into the Steps to Skip field.
31. Click Save Step to save this step and close the window.
226
SQLGet DataSet
Gets the result of the query and stores in a %sqldataset% variable to be used by the Fetch Dataset
Row function. The number of rows is stored in %sqldatasetrowcount%. This function runs on the
server.
Parameters
o
SQLQuery: The SQLstatement to run.
ODBC Connection:The ODBC connection to the database or leave blank to use the
LabTech database.
Examples
Example #1: Queries the LabTech database.
Parameters:
o
SQLStatement: SELECT `ComputerID`,`Name`,`OS`,'1' AS Query FROM `LabTech`.`computers` WHERE `ClientID` = %clientid% AND `LocationID` = %locationid% ;
ODBC Connection:
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLGet DataSet from the Function drop-down.
3. Enter SELECT `ComputerID`,`Name`,`OS`,'1' AS Query FROM `LabTech`.`computers` WHERE `ClientID` = %clientid% AND `LocationID` = %locationid% ;
into the SQLStatement field.
4. Leave the ODBC Connection field blank.
5. Click Save Step to save this step and close the window.
228
Example #2: Queries an external database, username and password included in ODBC.
Parameters:
o
SQLStatement: SELECT `Column1`,`Column2` FROM `Table`
ODBC Connection:DSN=myDSN;UID=myUsername;Pwd=myPassword;
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLGet DataSet from the Function drop-down.
3. Enter SELECT `Column1`,`Column2` FROM `Table` into the SQLStatement field.
4. Enter DSN=myDSN;UID=myUsername;Pwd=myPassword; into the ODBC Connection field. (Replace with valid external DB and credentials. Example is given to illustrate
syntax)
5. Click Save Step to save this step and close the window.
Example #3: Queries an external database, username and password not included in ODBC.
Parameters:
o
SQLStatement: SELECT `Column1`,`Column2` FROM `Table`
ODBC Connection:DSN=myDSN;
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLGet DataSet from the Function drop-down.
3. Enter SELECT `Column1`,`Column2` FROM `Table` into the SQLStatement field.
4. Enter DSN=myDSN; field. (Replace with valid external DB. Example is given to illustrate
syntax)
5. Click Save Step to save this step and close the window.
230
SQLGet Value
Gets the first columnof the first row returned by the query and saves it in %sqlresult%. This function runs on the server.
Parameters
o
SQLQuery: The SQLstatement to run.
ODBC Connection:The ODBC connection to the database or leave blank to use the
LabTech database.
Examples
Example #1: Returns the operating system of the local computer.
Parameters:
o
SQLStatement: SELECT DISTINCT os FROM computers WHERE computerid = %computerid%;
ODBC Connection:
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLGet Value from the Function drop-down.
3. Enter SELECT DISTINCT os FROM computers WHERE computerid = %computerid%; into the SQLStatement field.
4. Leave the ODBC Connection field blank.
5. Click Save Step to save this step and close the window.
232
Example #2: Queries an external database, username and password included in ODBC.
Parameters:
o
SQLStatement: SELECT DISTINCT `Column1` FROM `Table` WHERE `primarykey` =
'Value1';
ODBC Connection:DSN=myDSN;UID=myUsername;Pwd=myPassword;
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLGet Value from the Function drop-down.
3. Enter SELECT DISTINCT `Column1` FROM `Table` WHERE `primarykey` =
'Value1'; into the SQLStatement field.
4. Enter DSN=myDSN;UID=myUsername;Pwd=myPassword; into the ODBC Connection field. (Replace with valid external DB and credentials. Example is given to illustrate
syntax)
5. Click Save Step to save this step and close the window.
Example #3: Queries an external database, username and password not included in ODBC.
Parameters:
o
SQLStatement: SELECT DISTINCT `Column1` FROM `Table` WHERE `primarykey` =
'Value1';
ODBC Connection:DSN=myDSN;
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLGet Value from the Function drop-down.
3. Enter SELECT DISTINCT `Column1` FROM `Table` WHERE `primarykey` =
'Value1'; into the SQLStatement field.
234
4. Enter DSN=myDSN; into the ODBC Connection field. (Replace with valid external DB.
Example is given to illustrate syntax)
5. Click Save Step to save this step and close the window.
Template Property Get Value
Reads a template property and saves it to a variable. %templatepropertyfound% indicates if a property was found (1) or not (0). This function runs on the server.
Parameters
o
Extra Field: Select the template property from the drop-down. The list of template properties are retrieved from the database.
Variable:Puts the result in this variable, without the @ signs.
Default Value:Default value to use if a variable is not found.
Examples
Example #1: Retrieves the value of the Ignore Data Accumulation template that is contained in the
extra data field labeled 'Ignore_Accumulation.' LabTech Documentation provides step-by-step
instructions on how to create the associated 'Agent Property Template' in the 'Usage Sample' topic
in Using Template Based Properties.
Parameters:
o
Extra Field: Ignore_Accumulation
Variable:IgnoreAccumulation
Default Value:0
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SQLGet Value from the Function drop-down.
3. Enter Ignore_Accumulation into the Extra Field field.
4. Enter IgnoreAccumulation in the Variable field.
5. Enter 0 in the Default Value field.
6. Click Save Step to save this step and close the window.
236
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
238
CHAPTER 5
DecisionFunctions
This chapter provides parameter information, as well as examples for the various decision
functions available within LabTech.
IFAutoStartup Check
240
IF Console Logged On
243
IFDrive Status
246
IFFile Check
254
IFFile Compare
257
IFGroup Member
260
IFNew Unassigned Ticket
263
IFPatch Installed
266
IFPlugin Agent Command Available
269
IF PluginEnabled
270
IFPlugin Server Function Available
271
IF Process Exists
272
IFRegistry Check
275
IF Role Detected
278
IFService is Running
280
IFSmart Attributes
283
IFSoftware Installed
286
IFSQLData Check
289
IF Ticket Status
292
IFToolInstalled
293
IFUser Response
296
Match Goto
299
IFAutoStartup Check
Checks the startup value for result and sets the %=autostartupvalue%= variable. This function
runs on the agent.
Parameters
o
AutoStart Def: Select the location to check from the drop-down. Locations are retrieved
from the database.
Compare:Select the logical operator from the drop-down (exists, not exists, =, Not =, <, <=,
>, >=, Contains, Not Contains). Exists returns 'true' if AutoStart Def has any data.
To:The data to compare to the startup value.
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If a value exists at the 'Boot Execute' autostart definition location, set the %=auttostartupvalue%= variable and jump to the 'AutoStartupCheck' label.
Parameters:
o
AutoStart Def: Boot Execute
Compare:Exists
To:
Steps to Skip: :AutoStartupCheck
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF AutoStartup Check from the Function drop-down.
3. Select Boot Execute from the AutoStart Def drop-down.
4. Select Exists from the Compare drop-down.
5. Leave the To field blank.
6. Enter AutoStartupCheck into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
240
Example #2: If a value exists at the 'System Winlogon Notify' autostart definition location, set the
%=autostartupvalue%= variable and go to the next step. Otherwise, jump to 'NotAutoStartupCheck' label.
Parameters:
o
AutoStart Def: System Winlogon Notify
Compare:Exists
To:
Steps to Skip: !NotIFAutoStartupCheck
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF AutoStartup Check from the Function drop-down.
3. Select System Winlogon Notify from the AutoStart Def drop-down.
4. Select Exists from the Compare drop-down.
5. Leave the To field blank.
6. Enter !NotIFAutoStartupCheck into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
242
IF Console Logged On
Determines if a user is logged on and sets the %consolenumber% variable. This function runs on
the agent.
Parameters
o
Username: Checks to see if the specific user is logged on. Username is case sensitive.
Leave blank for any user.
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with a ! to invert the check.
Examples
Example #1: If the user @LTSG_UserName@ is logged on, it sets the %consolenumber% variable and jumps to the ConsoleLoggedOn label. This function example assumes that you have created a LTSG_Username variable using the Variable Set function.
Parameters:
o
Username: @LTSG_UserName@
Steps to Skip: :ConsoleLoggedOn
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Leave the Parameter field blank.
5. Enter LTSG_UserName into the Variable Name field.
6. Click Save Step to save this step and close the window.
7. Right-click the next line, select Add to open the Edit Script Step window.
8. Select IF Console Logged On from the Function drop-down.
9. Enter @LTSG_UserName@ into the Username field.
10. Enter :ConsoleLoggedOn into the Steps to Skip field.
11. Click Save Step to save this step and close the window.
Example #2: If any user is logged on, set the %consolenumber% variable and go to next step.
Otherwise, jump to 'NotConsoleLoggedOn' label.
Parameters:
o
Username:
Steps to Skip: !:NotConsoleLoggedOn
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Leave the Username field blank.
4. Enter :ConsoleLoggedOn into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
244
IFDrive Status
Returns 'true' if any of the conditions are met and sets the %driveletter% variable with the drive.
This function runs on the agent.
Parameters
o
FreeSpace: Minimum percentage of free space
Fragmentation: Maximum fragmentation that is acceptable for this drive
MFTFrag: Maximum MFTfragmentation that is acceptable
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert the check.
Examples
Example #1: If free space on drive is less than 30%, set the %driveletter% variable and jump to
'FreeSpaceDriveStatus' label.
Parameters:
o
FreeSpace: 30
Fragmentation:
MFTFrag:
Steps to Skip: :FreeSpaceDriveStatus
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFDrive Status from the Function drop-down.
3. Enter 30 into the FreeSpace field.
4. Leave Fragmentation field blank.
5. Leave MFT Frag field blank.
6. Enter :FreeSpaceDriveStatus into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
246
Example #2: If free space on drive is less than 30%, set the %=driveletter%= variable and go to
next step. Otherwise, jump to 'NotFreeSpaceDriveStatus' label.
Parameters:
o
FreeSpace: 30
Fragmentation:
MFTFrag:
Steps to Skip: !:NotFreeSpaceDriveStatus
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFDrive Status from the Function drop-down.
3. Enter 30 into the FreeSpace field.
4. Leave Fragmentation field blank.
5. Leave MFT Frag field blank.
6. Enter !:NotFreeSpaceDriveStatus into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
Example #3: If fragmentation on drive is greater than 10%, set the %=driveletter%= variable and
jump to 'FragmentationDriveStatus' label.
Parameters:
o
FreeSpace:
Fragmentation: 10
MFTFrag:
Steps to Skip: :FragmentationDriveStatus
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
248
open the Edit Script Step window.
2. Select IFDrive Status from the Function drop-down.
3. Leave FreeSpace field blank.
4. Enter 10 into the Fragmentation field.
5. Leave MFT Frag field blank.
6. Enter :FragmentationDriveStatus into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
Example #4: If fragmentation on drive is greater than 10%, set the %=driveletter%= variable and
go to next step. Otherwise, jump to 'NotFragmentationDriveStatus' label.
Parameters:
o
FreeSpace:
Fragmentation: 10
MFTFrag:
Steps to Skip: !:NotFragmentationDriveStatus
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFDrive Status from the Function drop-down.
3. Leave FreeSpace field blank.
4. Enter 10 into the Fragmentation field.
5. Leave MFT Frag field blank.
6. Enter !:NotFragmentationDriveStatus into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
Example #5: If MFT Frag on drive is greater than 5%, set the %=driveletter%= variable and jump
to 'MFTFragDriveStatus' label.
250
Parameters:
o
FreeSpace:
Fragmentation:
MFTFrag: 5
Steps to Skip: :MFTFragDriveStatus
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFDrive Status from the Function drop-down.
3. Leave the FreeSpace field blank.
4. Leave the Fragmentation field blank.
5. Enter 5 into the MFT Frag field.
6. Enter :MFTFragDriveStatus into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
Example #6: If MFT Frag on drive is greater than 5%, set the %=driveletter%= variable and go to
next step. Otherwise, jump to 'NotMFTFragDriveStatus' label.
Parameters:
o
FreeSpace:
Fragmentation:
MFTFrag: 5
Steps to Skip: !:NotMFTFragDriveStatus
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFDrive Status from the Function drop-down.
3. Leave the FreeSpace field blank.
4. Leave the Fragmentation field blank.
252
5. Enter 5 into the MFT Frag field.
6. Enter !:NotMFTFragDriveStatus into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
IFFile Check
Checks if the file exists or does not exist. This function runs on the agent.
Parameters
o
Filepath: Full path to the file to test
Compare: Select the logical operator from the drop-down (Exists, Not Exists)
Steps to Skip:Label to jump to or number of steps to skip when the result is true. Leave
blank or enter zero to exit script. Prefix with '!' to invert the check.
Examples
Example #1: If ipconfig.exe exists, jump to 'FileCheck' label.
Parameters:
o
Filepath: %windir%\system32\ipconfig.exe
Compare: Exists
Steps to Skip::FileCheck
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFFile Check from the Function drop-down.
3. Enter %windir%\system32\ipconfig.exe into the Filepath field.
4. Select Exists from the Compare drop-down.
5. Enter :FileCheck into the Steps to Skip field.
6. Click Save Step to save this step and close the window.
254
Example #1: If ipconfig.exe does not exist, jump to 'NotFileCheck' label.
Parameters:
o
Filepath: %windir%\system32\ipconfig.exe
Compare: Exists
Steps to Skip:!:NotFileCheck
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFFile Check from the Function drop-down.
3. Enter %windir%\system32\ipconfig.exe into the Filepath field.
4. Select Exists from the Compare drop-down.
5. Enter !:NotFileCheck into the Steps to Skip field.
6. Click Save Step to save this step and close the window.
256
IFFile Compare
Compares two files on the agent and returns true if they are identical. This function runs on the
agent.
Parameters
o
Check Type: Select type of file compare to perform from drop-down menu. (Created, Modified, Accessed, Version, Contents, Size, MD5)
File #1: Full path to filename without quotes
File #2: Full path to filename without quotes
Steps to Skip:Label to jump to or number of steps to skip when the result is true. Leave
blank or enter zero to exit script. Prefix with '!' to invert the check.
Examples
Example #1: If The contents of %tempdir%\LTSG_File1.txt equals contents of %tempdir%\LTSG_File2.txt, jump to the 'FileCompare' label.
Parameters:
o
Check Type: Contents
File #1: %tempdir%\LTSG_File1.txt
File #2: %tempdir%\LTSG_File2.txt
Steps to Skip::FileCompare
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFFile Compare from the Function drop-down.
3. Select Contents from the Check Type drop-down.
4. Enter %tempdir%\LTSG_File1.txt into the File #1 field.
5. Enter %tempdir%\LTSG_File2.txt into the File #2 field.
6. Enter :FileCompare into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
Example #2: If MD5 hash of %tempdir%\LTSG_File2.txt does not equal MD5 hash of %tempdir%\LTSG_File3.txt, jump to 'NotFileCompare' label.
Parameters:
o
Check Type: MD5
File #1: %tempdir%\LTSG_File2.txt
File #2: %tempdir%\LTSG_File3.txt
Steps to Skip:!:NotFileCompare
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFFile Compare from the Function drop-down.
3. Select MD5 from the Check Type drop-down.
4. Enter %tempdir%\LTSG_File2.txt into the File #1 field.
258
5. Enter %tempdir%\LTSG_File3.txt into the File #2 field.
6. Enter !:NotFileCompare into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
IFGroup Member
Tests if the computer is a member of the selected group or any of its children. This function runs on
the agent.
Parameters
o
Group Name: Select the name of the group to check if the specified computer is a member
from the drop-down.
Computer ID: Use @computerID@ for the current computer
Steps to Skip:Label to jump to or number of steps to skip when the result is true. Leave
blank or enter zero to exit script. Prefix with '!' to invert the check.
Examples
Example #1: Checks if the current computer is a member of the 'Service Plans.Windows Workstations.Managed 24x7' group, jump to 'GroupMember' label.
Parameters:
o
Group Name: Service Plans.Windows Workstations.Managed 24x7
Computer ID: @computerid@
Steps to Skip::GroupMember
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFGroup Member from the Function drop-down.
3. Select Service Plans.Windows Workstations.Managed 24x7 from the Group Name
drop-down.
4. Enter @computerid@ into the Computer ID field.
5. Enter :GroupMember into the Steps to Skip field.
6. Click Save Step to save this step and close the window.
260
Example #2: Checks if the current computer is not a member of the 'Windows Updates.Approved.Workstations', jump to 'NotGroupMember' label.
Parameters:
o
Group Name: Windows Updates.Approved.Workstations
Computer ID: @computerid@
Steps to Skip:!:NotGroupMember
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFGroup Member from the Function drop-down.
3. Select Windows Updates.Approved.Workstations from the Group Name drop-down.
4. Enter @computerid@ into the Computer ID field.
5. Enter !:NotGroupMember into the Steps to Skip field.
6. Click Save Step to save this step and close the window.
262
IFNew Unassigned Ticket
Sets the %ticketid% variable and jumps to the step defined in Steps To Skip when a new ticket
exists.This function runs on the agent.
Parameters
o
Client ID: The Client IDto search or leave blank for all clients
Steps to Skip:Label to jump to or number of steps to skip when the result is true. Leave
blank or enter zero to exit script. Prefix with '!' to invert the check.
Examples
Example #1: Checks if the current client (%clientid%) has an unassigned ticket, sets the %ticketid% variable and then jumps to 'NewUnassignedTicket' label.
Parameters:
o
Client ID: %clientid%
Steps to Skip::NewUnassignedTicket
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFNew Unassigned Ticket from the Function drop-down.
3. Enter %clientid% into the Client ID field.
4. Enter :NewUnassignedTicket into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
Example #2: If any client has an unassigned ticket, sets the %ticketid% variable and goes to the
next step. Otherwise, jumps to the 'NotNewUnassignedTicket' label.
Parameters:
o
Client ID:
Steps to Skip:!:NotNewUnassignedTicket
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFNew Unassigned Ticket from the Function drop-down.
3. Leave Client ID field blank.
4. Enter !:NotNewUnassignedTicket into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
264
IFPatch Installed
Checks if a patch is installed. This functions run on the agent.
Parameters
o
Patch ID: Select the patch from the drop-down.
Steps to Skip:Label to jump to or number of steps to skip when the result is true. Leave
blank or enter zero to exit script. Prefix with '!' to invert the check.
Examples
Example #1: If patch '2007 Microsoft Office Suite Service Pack 1 (SP1)' is installed, jump to
'PatchInstalled' label.
Parameters:
o
Patch ID: 2007 Microsoft Office Suite Service Pack 1 (SP1)
Steps to Skip::PatchInstalled
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFPatch Installed from the Function drop-down.
3. Enter 2007 Microsoft Office Suite Service Pack 1 (SP1) into the Patch ID field.
4. Enter :PatchInstalled into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
266
Example #2: If patch '2007 Microsoft Office Suite Service Pack 1 (SP1)' is not installed, jump to
'NotPatchInstalled' label.
Parameters:
o
Patch ID: 2007 Microsoft Office Suite Service Pack 1 (SP1)
Steps to Skip:!:NotPatchInstalled
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFPatch Installed from the Function drop-down.
3. Enter 2007 Microsoft Office Suite Service Pack 1 (SP1) into the Patch ID field.
4. Enter !:NotPatchInstalled into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
268
IFPlugin Agent Command Available
Checks if a plugin command exists and is ready for use. This function runs on the server. For SDK
use only.
IF PluginEnabled
Checks if a plugin is enabled. This function runs on the server. For SDK use only.
270
IFPlugin Server Function Available
Checks if a plugin function exists and is read for use. This function runs on the server. For SDK use
only.
IF Process Exists
Checks if the process is running and sets the %processid% variable. This function runs on the
server.
Parameters
o
Process Name: Name of the process or process ID to check
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If the process 'Notepad' is running, set %processid% variable and jump to 'ProcessExists' label.
Parameters:
o
Process Name: Notepad
Steps to Skip: :ProcessExists
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFPatch Installed from the Function drop-down.
3. Enter Notepad into the Process Name field.
4. Enter :ProcessExists into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
272
Example #2: If the process 'Notepad' is running, set %processid% variable and go to the next
step. Otherwise, jump to the 'NotProcessExists' label.
Parameters:
o
Process Name: Notepad
Steps to Skip: !:NotProcessExists
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFPatch Installed from the Function drop-down.
3. Enter Notepad into the Process Name field.
4. Enter !:NotProcessExists into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
274
IFRegistry Check
Checks to see if the registry value exists and sets the %registryresult% variable. This function runs
on the agent.
Parameters
o
Registry Key/Value: The key or value to be checked. To check a value, append the value
name to the full key path (e.g., HKCU\Software\LabTech\key\value).To check a key, end the
parameter with a backslash after the full key path (e.g., HKCU\Software\LabTech\key\).
Compare: Select the logical operator from the drop-down (Exists, Not Exists, =, Not =, <,
<=, >, >=, Contains, Not Contains). For registry keys, Exists and Not Exists are the only
applicable choices.
To: The data to compare the key/value to. Leave blank when using the Exists and Not Exists
operators.
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine\ registry key exists, set the %registryresult% variable and
jump to the 'NotRegistryCheck' label.
Parameters:
o
Registry Key/Value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\
Compare: Exists
To:
Steps to Skip: :RegistryCheck
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFRegistry Check from the Function drop-down.
3. Enter HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\ into the Registry Key/Value field.
4. Select Exists from the Compare drop-down.
5. Leave the To field blank.
6. Enter :RegistryCheck into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
Example #2: If HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine\PowerShellVersion registry value exists, set the %registryresult% variable and go to the next step. Otherwise, jump to the 'NotRegistryCheck' label.
Parameters:
o
Registry Key/Value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\PowerShellVersion
Compare: Exists
To:
Steps to Skip: !:NotRegistryCheck
Using the function example in a new or existing script :
276
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFRegistry Check from the Function drop-down.
3. Enter HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\PowerShellVersion into the Registry
Key/Value field.
4. Select Exists from the Compare drop-down.
5. Leave the To field blank.
6. Enter !:NotRegistryCheck into the Steps to Skip field.
IF Role Detected
Checks to see if a role has been detected exists. This function runs on the server.
Parameters
o
Role Definition: Select the role to check from the drop-down menu. The drop-down is populated based on the roles retrieved from the database.
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If the MSSQL role is detected, jump to the 'MSSQLRoleDetected' label. (The
MSSQL role will not be displayed if the role is not retrieved from the database).
Parameters:
o
Role Definition: MSSQL Server
Steps to Skip: :MSSQLServerRoleDetected
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFRole Detected from the Function drop-down.
3. Select MSSQL Server from the Role Definition drop-down.
4. Enter ::!MSSQLServerRoleDetected into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
278
Example #2: If the MSExchange role is detected, jump to the 'MSExchangeRoleNotDetected'
label. (The MSExchange role will not be displayed if the role is not retrieved from the database).
Parameters:
o
Role Definition: Exchange Server
Steps to Skip: !:ExchangeServerRoleNotDetected
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFRole Detected from the Function drop-down.
3. Select Exchange Server from the Role Definition drop-down.
4. Enter !:ExchangeServerRoleNotDetected into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
IFService is Running
Checks if the service is running and sets the %servicename% variable. This function runs on the
server.
Parameters
o
Service Name: Name of service to check
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If the service 'Spooler' is running, set the %servicename% variable and jump to the
'ServiceisRunning' label.
Parameters:
o
Service Name: Spooler
Steps to Skip: :ServiceisRunning
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFService is Running from the Function drop-down.
3. Enter Spooler into the Service Name field.
4. Enter :ServiceisRunning into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
280
Example #2: If the service 'Spooler' is running, set %servicename% variable and go to next step.
Otherwise, jump to the 'NotServiceisRunning' label.
Parameters:
o
Service Name: Spooler
Steps to Skip: !:NotServiceisRunning
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFService is Running from the Function drop-down.
3. Enter Spooler into the Service Name field.
4. Enter !:NotServiceisRunning into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
282
IFSmart Attributes
Tests if an attribute is under its threshold for the current computer and sets the %smartresult% variable with the drive. This function runs on the server.
Parameters
o
Smart Attribute: Select the attribute to test from the drop-down. The list of attributes are
retrieved from the database.
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If the SMART Attribute 'Endurance Remaining' has failed, set the %smartresult%
variable and jump to the 'SmartAttributes' label.
Parameters:
o
Smart Attribute: Endurance Remaining
Steps to Skip: :SmartAttributes
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFSmart Attributes from the Function drop-down.
3. Select Endurance Remaining from the Smart Attribute drop-down.
4. Enter :SmartAttributes into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
Example #2: If the SMART Attribute 'Average FHC' has failed, set the %smartresult% variable
and go to next step. Otherwise, jump to the 'NotSmartAttributes' label.
Parameters:
o
Smart Attribute: Average FHC
Steps to Skip: !:NotSmartAttributes
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFSmart Attributes from the Function drop-down.
3. Select Average FHC from the Smart Attribute drop-down.
4. Enter !:NotSmartAttributes into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
284
IFSoftware Installed
Checks if the software package is installed and sets the %softwarelocation% variable with the
path. Enter the name of the software exactly as it appears in the Program and Features of the
ControlPanel.
Parameters
o
App Name: The name of the application to check for. It must be exactly as it appears in the
Programs and Features of the ControlPanel.
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If the software '@softwarename@' is installed, set %softwarelocation% variable and
jump to the 'SoftwareInstalled' label. This function assumes that you have created a softwarename
variable using the Variable Set function.
Parameters:
o
App Name: @softwarename@
Steps to Skip: :SoftwareInstalled
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFSoftware Installed from the Function drop-down.
3. Select @softwarename@ from the App Name drop-down.
4. Enter :SoftwareInstalled into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
286
Example #2: If the software '@softwarename@' is installed, set %softwarelocation% variable and
go to next step. Otherwise, jump to 'NotSoftwareInstalled' label.
Parameters:
o
App Name: @softwarename@
Steps to Skip: !:NotSoftwareInstalled
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFSoftware Installed from the Function drop-down.
3. Select @softwarename@ from the App Name drop-down.
4. Enter !:NotSoftwareInstalled into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
288
IFSQLData Check
Tests a value from the database and sets the %sqlresult% variable. This function runs on the
server.
Parameters
o
Sql Statement: Query that returns a single value
Compare:Select a logical operator from the drop-down. (Exists, Not Exists, =, Not =, <, <=,
>, >=, Contains, Not Contains). The Exists operator returns true if query returns any data.
To:The data to compare to the results of the SQL query.
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
ODBC Connection: Enter the ODBCconnection or leave blank to use the LabTech database.
Examples
Example #1: If the result of the SQL Query exists, set the %sqlresult% variable and jump to the
'SQLDataCheck' label.
Parameters:
o
Sql Statement: SELECT DISTINCT os FROM computers WHERE computerid = %computerid%;
Compare:Exists
To:
Steps to Skip: :SQLDataCheck
ODBC Connection:
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFSQL Data Check from the Function drop-down.
3. Enter SELECT DISTINCT os FROM computers WHERE computerid = %computerid%; into the Sql Statement field.
4. Select Exists from the Compare drop-down.
5. Leave the To field blank.
6. Enter :SQLDataCheck into the Steps to Skip field.
7. Leave the ODBC Connection field blank to use the LabTech database.
8. Click Save Step to save this step and close the window.
Example #1: If the result of the SQL Query does not exist, set the %sqlresult% variable and go to
the next step. Otherwise, jump to the 'NotSQLDataCheck' label.
Parameters:
o
Sql Statement: SELECT DISTINCT os FROM computers WHERE computerid = %computerid%;
Compare:Exists
To:
Steps to Skip: !:NotSQLDataCheck
ODBC Connection:
Using the function example in a new or existing script :
290
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFSQL Data Check from the Function drop-down.
3. Enter SELECT DISTINCT os FROM computers WHERE computerid = %computerid%; into the Sql Statement field.
4. Select Exists from the Compare drop-down.
5. Leave the To field blank.
6. Enter !:NotSQLDataChec into the Steps to Skip field.
7. Leave the ODBC Connection field blank to use the LabTech database.
8. Click Save Step to save this step and close the window.
IF Ticket Status
Tests if a ticket is set to the selected status. This function runs on the server.
Parameters
o
Ticket ID: Ticket IDto test
Status: Select the status from the drop-down (Exists, New, Open, Stalled, Resolved, Billed
or Combined). Statuses will not be display if a ticket with that status does not exist in the database (e.g., if there are no open tickets, the 'Open' status will not display).
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If the ticket @ticketid@ is open, jump to 'TicketStatus' label. This function example
assumes that you have created a LTSG_TicketID variable using the Variable Set function.
Parameters:
o
Ticket ID: %ticketid%
Status: Open
Steps to Skip: :TicketStatus
Example #2: If the ticket @ticketid@ is new, go to the next step. Otherwise, jump to the 'NotTicketStatus' label. This function example assumes that you have created a LTSG_TicketID variable
using the Variable Set function.
Parameters:
o
Ticket ID: %ticketid%
Status: New
Steps to Skip: !:NotTicketStatus
292
IFToolInstalled
Checks to see if a tool/tweak is installed. The 'IF Tool Install' function may not work or display all
parameters if the required tool(s) have not been added to the LabTech server. Refer to Using
Tools and Tweaks for information on how to add tools to the server.This function runs on the
server.
Parameters
o
Tool ID: Select the tool to check from the drop-down. The list of tools is retrieved from the
database.
Steps to Skip: Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check. The Steps to Skip parameter will
only be displayed if a tool has been installed in LabTech.
Examples
Example #1: Checks to see if the Contig tool is installed and then jumps to the 'ToolInstalled'
label.Contig will not be displayed unless the tool has been added to LabTech
Parameters:
o
Tool ID: Contig
Steps to Skip: :ToolInstalled
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFTool Installed from the Function drop-down.
3. Select Contig from the Tool ID drop-down
4. Enter :ToolInstalled into the Steps to Skip field.
5. Click Save Step to save this step and close the window.
Examples
Example #2: Checks to see if the DCDiag tool is installed and if it is installed then it proceeds to the
next step. Otherwise, jumps to the 'NotToolInstalled'. DCDiag will not be displayed unless the tool
has been added to LabTech.
Parameters:
o
Tool ID: DCDiag
Steps to Skip: !:NotToolInstalled
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFTool Installed from the Function drop-down.
3. Select DCDiag from the Tool ID drop-down
4. Enter !:NotToolInstalled into the Steps to Skip field.
294
5. Click Save Step to save this step and close the window.
IFUser Response
Checks to see if a tool/tweak is installed. This function runs on the agent.
Parameters
o
Question: The question to ask the user
Console Number: Console number to ask the question. Get the console number using the
If Console Logged On function.
Steps to Skip:Label to jump to or number of steps to skip when the result is true. Leave
blank or enter 0 to exit script. Prefix with ! to invert check.
Examples
Example #1: If user response is YES, jump to the 'BeAutomated' label.
Parameters:
o
Question: Do you want to be automated?
Console Number: %consolenumber%
Steps to Skip: :BeAutomated
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFUser Response from the Function drop-down.
3. Enter Do you want to be automated? into the Question field.
4. Enter %consolenumber% into the Console Number field.
5. Enter :BeAutomated into the Steps to Skip field.
6. Click Save Step to save this step and close the window.
296
Example #2: If user response is NO, jump to the 'BeSwamped' label.
Parameters:
o
Question: Do you want to be automated?
Console Number: %consolenumber%
Steps to Skip: !:BeSwamped
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFUser Response from the Function drop-down.
3. Enter Do you want to be automated? into the Question field.
4. Enter %consolenumber% into the Console Number field.
5. Enter !:BeSwamped into the Steps to Skip field.
6. Click Save Step to save this step and close the window.
298
Match Goto
Goes to different labels in the script depending on the given value. This function runs on the server.
Parameters
o
Value: Variable name or value to match
Match Definition:Comma separated list of value/label pairs. Example: (1,:StartProc),
(2,:EndProc),(:DefaultLabel)
Examples
Example #1: Branch to :Label1, :Label2 or :Label3 if TestValue is 1, 2 or 3 respectively. Otherwise, jump to :Default label.
Parameters:
o
Value: @TestValue@
Match Definition:(1,:Label1),(2,Label2),(3,:Label3),(:Default)
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IFUser Response from the Function drop-down.
3. Enter @TestValue@ into the Value field.
4. Enter (1,:Label1),(2,Label2),(3,:Label3),(:Default) into the Match Definition field.
5. Click Save Step to save this step and close the window.
300
CHAPTER 6
File Functions
This chapter provides parameter information, as well as examples for the various file functions
available within LabTech.
File BITSDownload
302
File Copy
308
File Copy As Admin
310
File Copy As User
312
File Delete
314
File Delete As Admin
316
File Delete As User
318
File Download
320
File Download (Forced)
322
File Download URL
324
File Download URL(Forced)
326
File Rename
328
File Rename As Admin
330
File Rename As User
332
File Upload
334
File Write Text
336
File Zip
338
File BITSDownload
Downloads a file using the BITS Service or checks the status of a BITS download. This function
runs on the agent.
Parameters
o
Operation: Operation to perform, download or status check.
o
Download:The Download operation starts a BITSdownload, initializes
%BITSResults% with the BITSJob IDand passes the final status information to
a subscript launched when transfer is completed.
1. The 'Download' operation initiates a BITS download and returns the
BITS Job ID in %BITSResults%.
2. The 'Download' operation does not wait for the transfer to finish.
3. The 'ScriptID' parameter defines a subscript that will launch upon
completion of the BITS transfer.
4. Replacement variables with final status information are passed directly to the subscript launched after download completion.
5. 'LTSG BITS Transfer Complete' is an example of the subscript.
Status Check:The Status Check operation connects to the BITS service and
returns a string of NameValue pairs. Status information is passed in the following
replacement variables:@computerid@, @bitsjobid@, @totalfiles@, @transfiles@, @totalbytes@, @transbytes@, @bitsstarttime@, @bitsmodtime@ and
@bitsjobstatus@.
1. To retrieve status information of the BITS download during the transfer, use the 'Script Run' function to launch a status monitoring subscript.
2. The status monitoring subscript uses the 'Check Status' operation
with %BITSResults% in the Source parameter to connect to the
BITS service.
3. Status information is returned as a string of NameValue pairs in
%BITSResults%.
4. Since %BITSResults% is changed by the 'Check Status' operation,
subsequent calls to the 'Check Status' operation should use @bitsjobid@ in the Source parameter.
5. Replacement variables are assigned current status information by
using the 'Split NameValue Parameter' operation of the 'Variable Set'
function with the NameValue string in %BITSResult% as a parameter.
302
6. 'LTSG BITS Status During Transfer' is an example of the status monitoring subscript.
o
Source: URL of the file for the Download operation or the BITS Job ID for a Status Check
operation
Destination:Path to the destination of where to save the file (not applicable for Status
Check operation).
ScriptID:Script ID of the script to run when downloading completed. Replacement variables
with transfer status information are passed to script (not applicable for Status Check operation).
Examples
Example #1: Step Syntax of the Download operation, not designed to be executed.
Parameters:
o
Operation: Download
Source: http://download.example.com/examplepath/filename.iso
Destination: %tempdir%/filename.iso
ScriptID:5778
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File BITS Download from the Function drop-down.
3. Select Download from the Operation drop-down.
4. Enter http://download.example.com/examplepath/filename.iso into the Source field.
5. Enter %tempdir%/filename.iso into the Destination field.
6. Enter 5778 (for syntax example only, use appropriate ID for status check script) into the
ScriptID field.
7. Click Save Step to save this step and close the window.
Example #3: Step Syntax for Status Check operation, not designed to be executed.
Parameters:
Operation: Status Check
Source:@BITSResult@
Destination:
ScriptID:
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File BITS Download from the Function drop-down.
3. Select Status Check from the Operation drop-down.
4. Enter @BITSResult@ into the Source field.
5. Leave the Destination and ScriptID fields blank.
6. Click Save Step to save this step and close the window.
304
Example #3: Simple BITS download script (subscripts are located in the Labtech Script Guide >
_LTSC Resources folder)
Download Operation
Parameters:
o
Operation: Download
Source: http://download.ltmarketplace.com/contrib/toolpak70.exe
Destination: %tempdir%\toolpak70.exe
ScriptID:
Run Script
Parameters:
o
Script ID: LTSG BITS Status During Transfer
Delay: N/A
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File BITS Download from the Function drop-down.
3. Select Download from the Operation drop-down.
4. Enter http://download.ltmarketplace.com/contrib/toolpak70.exe into the Source field.
5. Enter %tempdir%\toolpak70.exe into the Destination field.
6. Enter 5778 (for syntax example only, use appropriate ID for status check script) into the
ScriptID field.
7. Click Save Step to save this step and close the window.
8. Right-click the next line in the Then or Else section, select Add to open the Edit Script
Step window
9. Select Script Run from the Function drop-down.
10. Select LTSG BITS Status During Transfer from the Script ID drop-down.
11. Leave Delay field blank.
12. Click Save Step to save this step and close the window.
306
File Copy
Copies a file on the remote computer. This function runs on the agent.
Parameters
o
Source Path: The full path of the source file, without quotes
Destination Path: The full path to file destination file, without quotes
Examples
Example #1: Copies the Prepare.bat file from %tempdir%\LTSG\ to %tempdir%\
Parameters:
o
Source Path: %tempdir%\LTSG\Prepare.bat
Destination Path: %tempdir%\Prepare.bat
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Copy from the Function drop-down.
3. Enter %tempdir%\LTSG\Prepare.bat into the Source Path field.
4. Enter %tempdir%\Prepare.bat into the Destination Path field.
5. Click Save Step to save this step and close the window.
308
File Copy As Admin
Copies a file on the remote computer using Admin permissions. The Login to use for Administrator Access must be set on the Deployment &Defaults tab of the location to use this function. This function runs on the agent.
Parameters
o
Source Path: The full path of the source file, without quotes
Destination Path: The full path to file destination file, without quotes
Examples
Example #1: Copies the Prepare.bat file from %tempdir%\LTSG\ to %tempdir%\ using the Admin
credentials.
Parameters:
o
Source Path: %tempdir%\LTSG\Prepare.bat
Destination Path: %tempdir%\Prepare.bat
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Copy as Admin from the Function drop-down.
3. Enter %tempdir%\LTSG\Prepare.bat into the Source Path field.
4. Enter %tempdir%\Prepare.bat into the Destination Path field.
5. Click Save Step to save this step and close the window.
310
File Copy As User
Copies a file on the remote computer using credentials of a specified user. This function runs on the
agent.
Parameters
o
Source Path: The full path of the source file, without quotes
Destination Path: The full path to file destination file, without quotes
Username: Enter the full username in Domain\User format. The value for Domain can be
the domain name, workgroup name or computer name.
Password:The password to use
Examples
Example #1: Copies the Prepare.bat file from %tempdir%\LTSG\ to %tempdir%\ using the specified user credentials.
Parameters:
o
Source Path: %tempdir%\LTSG\Prepare.bat
Destination Path: %tempdir%\Prepare.bat
Username:Workgroup\Username
Password:P@ssw0rd
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Copy as User from the Function drop-down.
3. Enter %tempdir%\LTSG\Prepare.bat into the Source Path field.
4. Enter %tempdir%\Prepare.bat into the Destination Path field.
5. Enter Workgroup\Username into the Username field.
6. Enter P@ssw0rd into the Password field.
7. Click Save Step to save this step and close the window.
312
File Delete
Deletes a file on the remote computer. This function runs on the agent.
Parameters
o
File Path: The full path of the source file to delete.
Examples
Example #1: Deletes the Automated.bat file.
Parameters:
o
File Path: %tempdir%\Automated.bat
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Delete from the Function drop-down.
3. Enter %tempdir%\Automated.bat into the File Path field.
4. Click Save Step to save this step and close the window.
314
File Delete As Admin
Deletes a file on the remote computer using Admin permissions. The Login to use for Administrator Access must be set on the Deployment &Defaults tab of the location to use this function. This function runs on the agent.
Parameters
o
File Path: The full path of the source file to delete
Examples
Example #1: Deletes the Automated.bat file using the Admin credentials.
Parameters:
o
File Path: %tempdir%\Automated.bat
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Delete as Admin from the Function drop-down.
3. Enter %tempdir%\Automated.bat into the File Path field.
4. Click Save Step to save this step and close the window.
316
File Delete As User
Deletes a file on the remote computer using credentials of a specified user. This function runs on
the agent.
Parameters
o
File Path: The full path of the source file to delete
Username: Enter the full username in Domain\User format. The value for Domain can be
the domain name, workgroup name or computer name.
Password:The password to use
Examples
Example #1: Deletes the Automated.bat file.
Parameters:
o
File Path: %tempdir%\Automated.bat
Username:Workgroup\Username
Password:P@ssw0rd
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Delete as User from the Function drop-down.
3. Enter %tempdir%\Automated.bat into the File Path field.
4. Enter Workgroup\Username into the Username field.
5. Enter P@ssw0rd into the Password field.
6. Click Save Step to save this step and close the window.
318
File Download
Transfers a file from the LabTech server and saves it to the local computer. This function runs on
the agent.
Parameters
o
Local File: Select the file on the server to be downloaded from the drop-down (the list of files
are populated by what is available in the LTShare\Transfer directory on the server).
Destination Path: The full path to file destination including the file name, without quotes.
Examples
Example #1: Downloads psexec.exe from the LabTech server.
Parameters:
o
Local File: Tools\psexec.exe
Destination Path: %tempdir%\LTSG\psexec.exe
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Download from the Function drop-down.
3. Enter Tools\psexec.exe into the Local File field.
4. Enter %tempdir%\LTSG\psexec.exe into the Destination Path field.
5. Click Save Step to save this step and close the window.
320
File Download (Forced)
Transfers a file from the LabTech server and saves it to the local computer. It forces the agent to
perform the download from the server, not the cache. This function runs on the agent.
Parameters
o
Local File: Select the file on the server to be downloaded from the drop-down (the list of files
are populated by what is available in the LTShare\Transfer directory on the server).
Destination Path: The full path to file destination including the file name, without quotes.
Examples
Example #1: Downloads pskill.exe from the LabTech server.
Parameters:
o
Local File: Tools\pskill.exe
Destination Path: %tempdir%\LTSG\pskill.exe
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Download (Forced) from the Function drop-down.
3. Enter Tools\pskill.exe into the Local File field.
4. Enter %tempdir%\LTSG\pskill.exe into the Destination Path field.
5. Click Save Step to save this step and close the window.
322
File Download URL
Downloads the file from an external site and saves it to a local file. This function runs on the agent.
Parameters
o
URL: URL to the file to be downloaded, urlencode any strange characters.
Local File: Full path to the file, including the filename, to save the URLas.
When to Return: Select when to return from the drop-down (Wait Until Finished, Return
Now). Use Wait UntilFinished to wait for the downloaded file if you need the file in the next
steps.
Examples
Example #1: Downloads ProcessExplorer.zip from website, saves file in the %tempdir%\LTSG\
directory and waits until download is complete before moving on to other steps in the script.
Parameters:
o
URL:http://download.sysinternals.com/files/ProcessExplorer.zip
Local File: %tempdir%\LTSG\ProcessExplorer.zip
When to Return: Wait Until Finished
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Download URL from the Function drop-down.
3. Enter http://download.sysinternals.com/files/ProcessExplorer.zip into the URL field.
4. Enter %tempdir%\LTSG\ProcessExplorer.zip into the Local File field.
5. Select Wait Until Finished from the When to Return drop-down.
6. Click Save Step to save this step and close the window.
324
File Download URL(Forced)
Downloads the file from an external site and saves it to a local file. The agent will be forced to perform the download from the server, not the cache. This function runs on the agent.
Parameters
o
URL: URL to the file to be downloaded, urlencode any strange characters.
Local File: Full path to the file, including the filename, to save the URLas.
When to Return: Select when to return from the drop-down (Wait Until Finished, Return
Now). Use Wait UntilFinished to wait for the downloaded file if you need the file in the next
steps.
Examples
Example #1: Downloads ProcessExplorer.zip from website, saves file in the %tempdir%\LTSG\
directory and waits until download is complete before moving on to other steps in the script.
Parameters:
o
URL:http://download.sysinternals.com/files/ProcessExplorer.zip
Local File: %tempdir%\LTSG\ProcessExplorer.zip
When to Return: Wait Until Finished
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Download URL (Forced) from the Function drop-down.
3. Enter http://download.sysinternals.com/files/ProcessExplorer.zip into the URL field.
4. Enter %tempdir%\LTSG\ProcessExplorer.zip into the Local File field.
5. Select Wait Until Finished from the When to Return drop-down.
6. Click Save Step to save this step and close the window.
326
File Rename
Renames or moves a file on the remote computer. This function runs on the agent.
Parameters
o
File Path: The full path of the source file to move/rename.
New Path: Full path to the new file.
Examples
Example #1: Renames the Prepare.bat file to Automated.bat.
Parameters:
o
File Path: %tempdir%\Prepare.bat
New Path: %tempdir%\Automated.bat
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Rename from the Function drop-down.
3. Enter %tempdir%\Prepare.bat into the File Path field.
4. Enter %tempdir%\Automated.bat into the New Path field.
5. Click Save Step to save this step and close the window.
328
File Rename As Admin
Renames or moves a file on the remote computer using Admin permissions. The Login to use for
Administrator Access must be set on the Deployment &Defaults tab of the location to use this
function. This function runs on the agent.
Parameters
o
File Path: The full path of the source file to move/rename.
New Path: Full path to the new file.
Examples
Example #1: Renames the Prepare.bat file to Automated.bat using the Admin credentials.
Parameters:
o
File Path: %tempdir%\Prepare.bat
New Path: %tempdir%\Automated.bat
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Rename as Admin from the Function drop-down.
3. Enter %tempdir%\Prepare.bat into the File Path field.
4. Enter %tempdir%\Automated.bat into the New Path field.
5. Click Save Step to save this step and close the window.
330
File Rename As User
Renames or moves a file on the remote computer using the credentials of a specified user. This
function runs on the agent.
Parameters
o
File Path: The full path of the source file to move/rename.
New Path: Full path to the new file.
Username: Enter the full username in Domain\User format. The value for Domain can be
the domain name, workgroup name or computer name.
Password:The password to use
Examples
Example #1: Renames the Prepare.bat file to Automated.bat.
Parameters:
o
File Path: %tempdir%\Prepare.bat
New Path: %tempdir%\Automated.bat
Username:Workgroup\Username
Password:P@ssw0rd
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Rename as User from the Function drop-down.
3. Enter %tempdir%\Prepare.bat into the File Path field.
4. Enter %tempdir%\Automated.bat into the New Path field.
5. Enter Workgroup\Username into the Username field.
6. Enter P@ssw0rd into the Password field.
7. Click Save Step to save this step and close the window.
332
File Upload
Sends a file from the remote computer to the LabTech server and saves it in the LTShare\Uploads
directory. It returns %uploadedfile% with the local path to the file. This function runs on the agent.
Parameters
o
File Path: Full path of the file to be uploaded
Examples
Example #1: Uploads the ltsgarchive.zip file to the LTShare\Uploads directory on the LabTech
server.
Parameters:
o
File Path: %tempdir%\LTSG\ltsgarchive.zip
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Rename as User from the Function drop-down.
3. Enter %tempdir%\LTSG\ltsgarchive.zip into the File Path field.
4. Click Save Step to save this step and close the window.
334
File Write Text
Saves text to a file on the remote computer. This function runs on the agent.
Parameters
o
Text File: The full path to the file. Using this function will replace the existing file.
Data: The text to write to this file.
Examples
Example #1: Creates a batch file on the remote computer.
Parameters:
o
Text File: %tempdir%\LTSG\Prepare.bat
Data:Echo "Prepare to be Automated!"
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Write Text from the Function drop-down.
3. Enter %tempdir%\LTSG\Prepare.bat into the Text File field.
4. Enter Echo "Prepare to be Automated!" into the Data field.
5. Click Save Step to save this step and close the window.
336
File Zip
Adds a list of files to a compressed zip archive. This function runs on the agent.
Parameters
o
Path List: A comma separated list of full paths
Archive:The full path to save the zip archive
Examples
Example #1: Zips the psexec.exe, pskill.exe and Prepare.bat files into the ltsgarchive.zip archive.
Parameters:
o
PathList: %tempdir%\LTSG\psexec.exe,%tempdir%\LTSG\pskill.exe,%tempdir%\LTSG\Prepare.bat
Archive:%tempdir%\LTSG\ltsgarchive.zip
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Zip from the Function drop-down.
3. Enter %tempdir%\LTSG\psexec.exe,%tempdir%\LTSG\pskill.exe,%tempdir%\LTSG\Prepare.bat
into PathList field.
4. Enter %tempdir%\LTSG\ltsgarchive.zip into the Archive field.
5. Click Save Step to save this step and close the window.
338
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
340
CHAPTER 7
Folder Functions
This chapter provides parameter information, as well as examples for the various folder functions
available within LabTech.
Folder Create
342
Folder Create as Admin
344
Folder Create As User
346
Folder Delete
348
Folder Delete As Admin
350
Folder Delete As User
352
Folder Move
354
Folder Move As Admin
356
Folder Move As User
358
Folder Create
Creates a folder on the target computer. This function runs on the agent.
Parameters
o
Folder:Enter the full path to the new folder
Examples
Example #1: Creates an LTsgTest folder in the temp directory.
Parameters:
o
Folder:%tempdir%\LtsgTest
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Create from the Function drop-down.
3. Enter %tempdir%\LTSG into the Folder field.
4. Click Save Step to save this step and close the window.
342
Folder Create as Admin
Creates a folder on the target computer using Admin credentials. This function runs on the agent.
Parameters
o
Folder:Enter the full path to the new folder
Examples
Example #1: Creates an LTsgTest folder in the temp directory using the Admin credentials
Parameters:
o
Folder:%tempdir%\LtsgTest
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Create from the Function drop-down.
3. Enter %tempdir%\LTSG into the Folder field.
4. Click Save Step to save this step and close the window.
344
Folder Create As User
Creates a folder on the target computer using credentials of the specified user. This function runs
on the agent.
Parameters
o
Folder:Enter the full path to the new folder
Username:Enter the full username in Domain\User format. The value for domain can be
the domain name, workgroup name or computer name.
Password:Enter the password to use
Examples
Example #1: Creates an LTsgTest folder in the temp directory using the credentials of the specified user.
Parameters:
o
Folder:%tempdir%\LtsgTest
Username:Domain\Username
Password:P@ssw0rd
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Create as User from the Function drop-down.
3. Enter %tempdir%\LtsgTest into the Folder field.
4. Enter Domain\Username in the Username field.
5. Enter P@ssw0rd in the Password field.
6. Click Save Step to save this step and close the window.
346
Folder Delete
Deletes a folder on the target computer. This function runs on the agent.
Parameters
o
Folder:Enter the full path to the folder to delete
Examples
Example #1: Deletes the %tempdir%\LTSG\LtsgTest folder
Parameters:
o
Folder:%tempdir%\LTSG\LtsgTest
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Delete from the Function drop-down.
3. Enter %tempdir%\LTSG\LtsgTest into the Folder field.
4. Click Save Step to save this step and close the window.
348
Folder Delete As Admin
Deletes a folder on the target computer using Admin credentials. This function runs on the agent.
Parameters
o
Folder:Enter the full path to the folder to delete
Examples
Example #1: Deletes the %tempdir%\LTSG\LtsgTest folder using Admin credentials.
Parameters:
o
Folder:%tempdir%\LTSG\LtsgTest
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Delete as Admin from the Function drop-down.
3. Enter %tempdir%\LTSG\LtsgTest into the Folder field.
4. Click Save Step to save this step and close the window.
350
Folder Delete As User
Deletes a folder on the target computer using the credentials of a specified user. This function runs
on the agent.
Parameters
o
Folder:Enter the full path to the folder to delete
Username:Enter the full username in Domain\User format. The value for domain can be
the domain name, workgroup name or computer name.
Password:Enter the password to use
Examples
Example #1: Deletes the %tempdir%\LTSG\LtsgTest folder using the credentials of a specified
user.
Parameters:
o
Folder:%tempdir%\LTSG\LtsgTest
Username: Domain\Username
Password:P@ssw0rd
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Delete as User from the Function drop-down.
3. Enter %tempdir%\LTSG\LtsgTest into the Folder field.
4. Enter Domain\Username in the Username field.
5. Enter P@ssw0rd in the Password field.
6. Click Save Step to save this step and close the window.
352
Folder Move
Moves a folder on the target computer to a new location. This function runs on the agent.
Parameters
o
Source Folder:Enter the full path of the folder to move
Dest Folder:Enter the full path to the new location
Examples
Example #1: Moves %tempdir%\LtsgTest to %tempdir%\LTSG\LtsgTest.
Parameters:
o
Folder:%tempdir%\LtsgTest
Dest Folder:%tempdir%\LTSG\LTsgTest
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Move from the Function drop-down.
3. Enter %tempdir%\LtsgTest into the Source Folder field.
4. Enter %tempdir%\LTSG\LtsgTest in the Dest Folder field.
5. Click Save Step to save this step and close the window.
354
Folder Move As Admin
Moves a folder on the target computer to a new location using Admin credentials. This function
runs on the agent.
Parameters
o
Source Folder:Enter the full path of the folder to move
Dest Folder:Enter the full path to the new location
Examples
Example #1: Moves %tempdir%\LtsgTest to %tempdir%\LTSG\LtsgTest using Admin credentials.
Parameters:
o
Folder:%tempdir%\LtsgTest
Dest Folder:%tempdir%\LTSG\LTsgTest
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Move as Admin from the Function drop-down.
3. Enter %tempdir%\LtsgTest into the Source Folder field.
4. Enter %tempdir%\LTSG\LtsgTest in the Dest Folder field.
5. Click Save Step to save this step and close the window.
356
Folder Move As User
Moves a folder on the target computer to a new location using the credentials of a specified user.
This function runs on the agent.
Parameters
o
Source Folder:Enter the full path of the folder to move
Dest Folder:Enter the full path to the new location
Username:Enter the full username in Domain\User format. The value for domain can be
the domain name, workgroup name or computer name.
Password:Enter the password to use
Examples
Example #1: Moves %tempdir%\LtsgTest to %tempdir%\LTSG\LtsgTest using the credentials of
a specified user.
Parameters:
o
Folder:%tempdir%\LtsgTest
Dest Folder:%tempdir%\LTSG\LTsgTest
Username: Domain\Username
Password:P@ssw0rd
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Folder Move as User from the Function drop-down.
3. Enter %tempdir%\LtsgTest into the Source Folder field.
4. Enter %tempdir%\LTSG\LtsgTest in the Dest Folder field.
5. Enter Domain\Username in the Username field.
6. Enter P@ssw0rd in the Password field.
7. Click Save Step to save this step and close the window.
358
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
360
CHAPTER 8
LabTech Functions
This chapter provides parameter information, as well as examples for the various LabTech
functions available within LabTech.
LabTech Agent Uninstall
362
LabTech Agent Update
363
LabTechCommand
365
LabTech FasTalk
366
LabTech License Deactivate
370
LabTech License Retrieve
372
LabTechPluginAlert
374
LabTech Probe Control
376
LabTech Send Message to Computer
380
LabTech Agent Uninstall
Uninstalls the LabTech agent from the target computer. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Uninstalls the LabTech agent from the target computer.
Parameters:
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech Agent Uninstall from the Function drop-down.
3. Click Save Step to save this step and close the window.
362
LabTech Agent Update
Sends a command to the LabTech Agent to update itself to the latest version, the agent will update
EVEN if it has the same version to refresh its files and correct any errors. This command returns
immediately and no further commands can be sent to the computer. This function runs on the
agent.
Parameters
o
None
Examples
Example #1: Updates the LabTech agent on the target computer
Parameters:
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech Agent Update from the Function drop-down.
3. Click Save Step to save this step and close the window.
364
LabTechCommand
Runs an internal LabTech command and is for LabTech INTERNAL use only. This function may
run on the server or the agent, the location is dependent on the script chosen.
LabTech FasTalk
Sets FasTalk to 'off' or 'on'. Toggle the FasTalk state by sending a FasTalk packet across the network for delivery to the agent via the target computer. This function runs on the agent.
Parameters
o
Control:Enter 1 for 'on' 00 for 'off' or enter an IPaddress to send a network packet.
Examples
Example #1: Toggles FasTalk to 'on'.
Parameters:
o
Control:1
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech FastTalk from the Function drop-down.
3. Enter 1 in the Control field.
4. Click Save Step to save this step and close the window.
366
Example #2: Toggles FasTalk to 'off'.
Parameters:
o
Control:00
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech FastTalk from the Function drop-down.
3. Enter 00 in the Control field.
4. Click Save Step to save this step and close the window.
Example #3: Toggles the FasTalk state
Parameters:
o
Control:@LTSG_IPAddress@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech FastTalk from the Function drop-down.
3. Enter @LTSG_IPAddress@ in the Control field.
4. Click Save Step to save this step and close the window.
368
LabTech License Deactivate
Deactivates a retrieved license. This function runs on the server.
Parameters
o
LicenseIdentifier:The identifier of the retrieved license, typically %obtainedlicenseid%.
Examples
Example #1: Deactivates the specified client license
Parameters:
o
License Identifier:%obtainedlicenseid%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech License Deactivate from the Function drop-down.
3. Enter %obtainedlicenseid% in the License Identifier field.
4. Click Save Step to save this step and close the window.
370
LabTech License Retrieve
Retrieves a license and populates the following three variables: This function runs on the server.
o
%obtainedlicense% contains the license
%obtainedlicenseid% is the license identifier
%licencesuccess% indicates whether license found (1) or not (0).
Parameters
o
LicenseType:Select the license type from the drop-down. The list of licenses is retrieved
from the database.
Target Type: Select the target type from the drop-down (System, Client,
Location,Computer).
Target ID:The target IDof the license, if known. Otherwise, enter 0.
Examples
Example #1: Retrieves the HitmanPro Client License
Parameters:
o
License Type:HItmanPro Client License
Target Type:System
Target ID: 0
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech License Retrieve from the Function drop-down.
3. Enter HitmanPro Client License in the License Type drop-down.
4. Select System from the Target Type drop-down.
5. Enter 0 in the Target Id field.
6. Click Save Step to save this step and close the window.
372
LabTechPluginAlert
This command is used to run plugins from scripts. This is a very advanced function and parameters
are determined by the plugin. Function allows a monitor to raise an alert by running a plugin from a
script, returns the results to %pluginalertresult%. This function runs on the agent.
Parameters
o
Plugin Alert ID:Override default alert actions. (pager=4, voice=8, fax=16, print=32, filee=64, messenger=128, instant message=256, customalert1=8192, customalert2=16384
and customalert3=32768.
Client ID: Enter the client ID to search or leave blank for all clients
Computer ID: Enter the computer IDto search for. Use @=computerid@= for the current
computer.
Message:Alert message to use
Agent Name: Name of the monitor that generates the alert.
Examples
Example #1: Configures a monitor to use a plugin to raise an alert.
Parameters:
o
Plugin Alert ID:256
Client ID: %clientid%
Computer ID: @computerid@
Message:The @LTSG_MonitorName@ triggered this alert which uses a plugin to deliver
the alert by instance message.
Agent Name: @LTSG_MonitorName@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech Plugin Alert from the Function drop-down.
3. Enter 256 in the Plugin Alert ID field.
4. Enter %clientid% in the ClientID field.
5. Enter @computerid@ in the ComputerID field.
6. Enter The @LTSG_MonitorName@ triggered this alert which uses a plugin to
deliver the alert by instance message. in the Message field.
374
7. Enter @LTSG_MonitorName@ in the Agent Name field.
8. Click Save Step to save this step and close the window.
LabTech Probe Control
Controls the probe by sending commands to the current computer. This function runs on the agent.
Parameters
o
Control Command:Select the command to send to the probe from the drop-down (Reattempt Push, Reinventory Devices, Rescan Network).
Examples
Example #1: Attempts to install an agent following a failed attempt.
Parameters:
o
Control Command:Reattempt push
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech Probe Control from the Function drop-down.
3. Select Reattempt Push from the Control Command drop-down.
4. Click Save Step to save this step and close the window.
376
Example #2: Reinventories devices on the network
Parameters:
o
Control Command:Reinventory Devices
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech Probe Control from the Function drop-down.
3. Select Reinventory Devices from the Control Command drop-down.
4. Click Save Step to save this step and close the window.
Example #3: Scans the network to find network devices
Parameters:
o
Control Command:Rescan network
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech Probe Control from the Function drop-down.
3. Select Rescan Network from the Control Command drop-down.
4. Click Save Step to save this step and close the window.
378
LabTech Send Message to Computer
Sends a LabTech Messaging System pre-formatted message to the user. Information on how to
create and edit pre-formatted messages can be found in the LabTech Documentation:Using
LabTech > Messaging > Using the Messaging System. This function runs on the agent.
Parameters
o
Message:Select the message from the drop-down. The list of messages is retrieved from
the database.
Computer ID: Computer IDof the computer where message should be sent.
Parameters to Pass to the Script: Parameters to pass to script associated with the message
Examples
Example #1: Uses the LabTech Messaging System to request contact information from the user
of the specified computer.
Parameters:
o
Message:Contact Information
Computer ID: @computerid@
Parameters to Pass to the Script:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LabTech Send Message to Computer from the Function drop-down.
3. Select Contact Information from the Message drop-down.
4. Enter @computerid@ in the Computer ID field.
5. Enter any extra parameters to replace with this script in the Parameters to Pass to the
Script field.
6. Click Save Step to save this step and close the window.
380
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
382
CHAPTER 9
LabTech Server Functions
This chapter provides parameter information, as well as examples for the various LabTech Server
functions available within LabTech.
LTServer Alert Delete
384
LTServer Call AlertTemplate
387
LTServer Create Alert
390
LTServer Download to Server
393
LTServer Execute
395
LTServer Net Send
397
LTServer Pager Message
399
LTServer Record Stat
401
LTServer Send Fax
403
LTServer ShellExecute
405
LTServer Voice Message
407
LTServer Write To File
409
LTServer Alert Delete
Deletes a specified alert. This function runs on the server.
Parameters
o
Alert ID:The ID of the alert to delete
Examples
Example #1: Deletes a system alert. This function assumes that you created an LTSG_SystemAlertID variable using the Variable Set function.
Parameters:
o
Alert ID:@LTSG_SystemAlertID@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Alert Delete from the Function drop-down.
3. Enter @LTSG_SystemAlertID@ in the AlertID field.
4. Click Save Step to save this step and close the window.
384
Example #2: Deletes a computer alert. This function assumes that you created an LTSG_ComputerAlertID variable using the Variable Set function.
Parameters:
o
Alert ID:@LTSG_ComputerAlertID@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Alert Delete from the Function drop-down.
3. Enter @LTSG_ComputerAlertID@ in the AlertID field.
4. Click Save Step to save this step and close the window.
386
LTServer Call AlertTemplate
Calls an alert template and performs the defined actions. This function runs on the server.
Parameters
o
Alert Message:The alert message to use. This can be blank.
Failed: Sets the state of the alert template using the drop-down (True or False).
Agent ID: Enter the monitor IDto associate with the alert. Monitor IDs can be found in the
title bar of the monitor after opening the monitor to the configuration screens.
Agent Name: Enter the monitor name to associate with the alert
Alert Template: Enter the alert template IDto use. Alert template IDs can be found in the
Dashboard > Management >Alert Templates.
Examples
Example #1: Calls alert template to set the state to FAILED. This function example assumes that
you created an LTSG_Alert_Template variable.
Parameters:
o
Alert Message:Calling alert to set state to FAILED
Failed: True
Agent ID: %agentid%
Agent Name: LTSG_Alert_Example
Alert Template: @LTSG_Alert_Template
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Call Alert Template from the Function drop-down.
3. Enter Calling alert to set state to FAILED. in the Alert Message field.
4. Select True from the Failed drop-down.
5. Enter %agentid% in the Agent ID field.
6. Enter LTSG_Alert_Example in the Agent Name field.
7. Enter @LTSG_Alert_Template@ in the Alert Template field.
8. Click Save Step to save this step and close the window.
Example #2: Calls alert template to set the state to NOTFAILED. This function example assumes
that you created an LTSG_Alert_Template variable.
Parameters:
o
Alert Message:Calling alert to set state to NOTFAILED
Failed: False
Agent ID: %agentid%
Agent Name: LTSG_Alert_Example
Alert Template: @LTSG_Alert_Template@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Call Alert Template from the Function drop-down.
3. Enter Call alert to go set state to NOT FAILED. in the Alert Message field.
4. Select False from the Failed drop-down.
388
5. Enter %agentid% in the Agent ID field.
6. Enter LTSG_Alert_Example in the Agent Name field.
7. Enter @LTSG_Alert_Template@ in the Alert Template field.
8. Click Save Step to save this step and close the window.
LTServer Create Alert
Creates an alert and returns %AlertID% with the ID of the alert created. This function runs on the
server.
Parameters
o
Computer ID:The computer IDto link the alert to. Enter 0 to create a system alert or @computerid@ to create a computer alert
Severity: Select the severity of the alert from the drop-down (Informational, Low Severity,
Medium Severity, High Severity).
Body: Body of the message.
Subject: Subject or source of the alert.
Examples
Example #1: Creates a system alert.
Parameters:
o
Computer ID:0
Severity: Informational
Body: This is a system alert
Subject: LabTech Script Guide
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Create Alert from the Function drop-down.
3. Enter 0 in the Computer ID field.
4. Select Informational from the Severity drop-down.
5. Enter This is a system alert. in the Body field.
6. Enter LabTech Script Guide in the Subject field.
7. Click Save Step to save this step and close the window.
390
Example #2: Creates a computer alert.
Parameters:
o
Computer ID:@computerid@
Severity: Informational
Body: This is a computer alert
Subject: LabTech Script Guide
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Create Alert from the Function drop-down.
3. Enter @computerid@ in the Computer ID field.
4. Select Informational from the Severity drop-down.
5. Enter This is a computer alert. in the Body field.
6. Enter LabTech Script Guide in the Subject field.
7. Click Save Step to save this step and close the window.
392
LTServer Download to Server
Downloads a file from a URL and saves it to the LabTech server. This function runs on the
agent/server.
Parameters
o
URL:The URLwhere the file needs to be downloaded from
Local File: Path to the location where the file will be saved on the LabTech server
Examples
Example #1: Downloads the Microsoft FixIt installation file and saves it to the Windows Temp
folder.
Parameters:
o
URL:http://www.microsoft.com/technet/security/advisory/2501696.mspx
Local File: %tempdir%\MicrosoftFixIt.mspx
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Download to Server from the Function drop-down.
3. Enter http://www.microsoft.com/technet/security/advisory/2501696.mspx in the URL
field.
4. Enter %tempdir%\MicrosoftFixIt.mspx in the Local File field.
5. Click Save Step to save this step and close the window.
394
LTServer Execute
Runs a program on the LabTech server. The program must not show windows or require and user
action. This function runs on the server.
Parameters
o
Program Path:The URLwhere the file needs to be downloaded from
Arguments: Parameters to pass to the program
Examples
Example #1: Runs a process in the background to demonstrate the process is running in the context of the LabTech agent.
Parameters:
o
Program Path:%windir%\system32\cscript.exe
Arguments: %tempdir%\LTSG_TestLTServerExecute.vbs
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Execute from the Function drop-down.
3. Enter %windir%\system32\cscript.exe in the Program Path field.
4. Enter %tempdir%\LTSG_TestLTServerExecute.vbs in the Arguments field.
5. Click Save Step to save this step and close the window.
396
LTServer Net Send
Sends a NetBIOSmessage from the LabTech server. This function runs on the agent.
Parameters
o
NetBios Name:The computer or user to send the message to
Message: The message to send
Examples
Example #1: Sends a message to a computer on the local network. This function assumes that
you have created a LTSG_NetBiosName variable using the Variable Set function.
Parameters:
o
NetBios Name:@LTSG_NetBiosName@
Message: Thank you for using LabTech. Prepare to Be Automated!
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Net Send from the Function drop-down.
3. Enter @LTSG_NetBiosName@ in the NetBios Name field.
4. Enter Thank you for using LabTech. Prepare to Be Automated! in the Message field.
5. Click Save Step to save this step and close the window.
398
LTServer Pager Message
Sends a pager message from the LabTech server. This function runs on the agent.
Parameters
o
Phone Number:The phone number to dial
Message:Numeric message to send
Examples
Example #1: Sends a pager a message
Parameters:
o
Phone Number:18005551212
Message:18885554545
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Pager Message from the Function drop-down.
3. Enter 18005551212 in the Phone Number field.
4. Enter 18885554545 in the Message field.
5. Click Save Step to save this step and close the window.
400
LTServer Record Stat
Stores up to to 20 values per computer in the LabTech database to be used with reporting. Values
for stat numbers over 10 can be strings. This function runs on the server.
Parameters
o
Stat Number:Select the extra stat from the drop-down (e.g., 1-20).
Value: The value of the stat to be recorded
Computer ID: The computer IDto record the stat for
Examples
Example #1: Sets a record stat value to be used in reports. This function example assumes that
you have created an LTSG_ComputerID variable using the Variable Set function.
Parameters:
o
Stat Number:1
Value: 100
Computer ID: @LTSG_ComputerID@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Record Stat from the Function drop-down.
3. Select 1 from the Stat Number drop-down.
4. Enter 100 in the Value field.
5. Enter @LTSG_ComputerID@ in the Computer ID field.
6. Click Save Step to save this step and close the window.
402
LTServer Send Fax
Sends a fax from the LabTech server. This function runs on the agent.
Parameters
o
Phone Number:The phone number to dial
Message:Message to fax
Examples
Example #1: Sends a fax
Parameters:
o
Phone Number:18005551212
Message:Your fax message
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Send Fax from the Function drop-down.
3. Enter 18005551212 in the Phone Number field.
4. Enter Your fax message. in the Message field.
5. Click Save Step to save this step and close the window.
404
LTServer ShellExecute
Executes a shell command on the LabTech server and returns the results to %=shellresult%=. This
function runs on the server.
Parameters
o
Command:The command to run (e.g., netstat)
Arguments: Parameters to pass to the executable
Examples
Example #1: Runs netstat- an at the command line in a shell on the LabTech server.
Parameters:
o
Command:netstat
Arguments: -an
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Shell Execute from the Function drop-down.
3. Enter netstat in the Command field.
4. Enter -an in the Arguments field.
5. Click Save Step to save this step and close the window.
406
LTServer Voice Message
Places a voice call from the LabTech server to deliver an automated message. This function runs
on the agent.
Parameters
o
Phone Number:The phone number to dial
Message:The message to be read over the phone
Examples
Example #1: Makes an automated call
Parameters:
o
Phone Number:18005551212
Message:Thank you for using LabTech. Prepare to Be Automated!
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Voice Message from the Function drop-down.
3. Enter 18005551212 in the Phone Number field.
4. Enter Thank you for using LabTech. Prepare to Be Automated! in the Message field.
5. Click Save Step to save this step and close the window.
408
LTServer Write To File
Create a file or appends text to an existing file on the LabTech server. This function runs on the
agent.
Parameters
o
File Name:Full path to the file
Message:The text data to write to the file
Examples
Example #1: Creates and append to a log file on the LabTech server.
Parameters:
o
File Name:%tempdir%\Prepare.bat
Message:Echo "Prepare to be Automated!"
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select LTServer Write to File from the Function drop-down.
3. Enter %tempdir%\Prepare.bat in the File Name field.
4. Enter Echo "Prepare to be Automated!" in the Message field.
5. Click Save Step to save this step and close the window.
410
CHAPTER 10
Management Functions
This chapter provides parameter information, as well as examples for the various Management
functions available within LabTech.
Add User Accounts
412
Generate Random Password
414
Maintenance Mode Clear
416
Maintenance Mode Start
418
Offline Backup
420
Patch Approve
423
Patch Install
425
Patch Install All
427
Virus Definition Update
431
Virus Scan
433
Windows Update Settings - Disable Access to Windows Update
435
Windows Update Settings - Disable Windows Updates
437
Windows Update Settings - Enable Windows Update Time
439
Windows Update Settings - Force Windows Update
442
Windows Update Settings - Install Windows Update Agent
444
Windows Update Settings - Restore Defaults
446
Windows Update Settings - Set LabTech Mode
448
Windows Update Settings - Set WSUS Server
450
Windows Update Settings - Windows Update Download Only
453
Add User Accounts
Adds a new user account to the local computer unless this is a domain controller, then it creates a
domain account. This function runs on the agent.
Parameters
o
Username:Username to create. Do not include the domain name or quotes
Password:Password to use for the new user account
Examples
Example #1: Adds the 'LTSG_UserAccount' account to the local computer or domain. This function example assumes that you have created LTSG_UserAccount and LTSG_Password variables
using the Variable Set function.
Parameters:
o
Username:@LTSG_UserAccount@
Password:@LTSG_Password@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Add User Accounts from the Function drop-down.
3. Enter @LTSG_UserAccount@ in the Username field.
4. Enter @LTSG_Password@ in the Password field.
5. Click Save Step to save this step and close the window.
412
Generate Random Password
Generates a random password based on the given parameters and sets the %randompassword%
variable (all parameters must be numeric or blank).This function runs on the server.
Parameters
o
Minimum Length:Minimum password length (required, must be greater than 0)
Maximum Length:Maximum password length(required, must be greater than the minimum length)
Minimum Special Characters: Minimum number of special characters (e.g., #$%)
Minimum Numerical Characters: Minimum number of numerical characters
Minimum Upper Case Characters:Minimum number of upper case characters
Examples
Example #1: Generates a random password with: length greater than 14 and less than 31 with
greater than one special character, numerical character and upper case character.
Parameters:
o
Minimum Length:14
Maximum Length:31
Minimum Special Characters: 2
Minimum Numerical Characters: 2
Minimum Upper Case Characters:2
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Generate Random Password from the Function drop-down.
3. Enter 15 in the Minimum Length field.
4. Enter 30 in the Maximum Length field.
5. Enter 2 in the Minimum Special Characters field.
6. Enter 2 in the Minimum Numerical Characters field.
7. Enter 2 in the Minimum Upper Case Characters field.
8. Click Save Step to save this step and close the window.
414
Maintenance Mode Clear
Clears the maintenance mode for the selected computer. This function runs on the server.
Parameters
o
ComputerID:Computer ID of the computer
Examples
Example #1: Clears the maintenance mode on the target computer.
Parameters:
o
ComputerID:@computerid@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Maintenance Mode Clear from the Function drop-down.
3. Enter @computerid@ in the ComputerID field.
4. Click Save Step to save this step and close the window.
416
Maintenance Mode Start
Sets the maintenance mode for the selected computer. This function runs on the server.
Parameters
o
ComputerID:Computer ID of the computer
Duration:Enter the number of minutes the maintenance mode window should last
Examples
Example #1: Starts a two hour maintenance window on the target computer.
Parameters:
o
ComputerID:@computerid@
Duration:120
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Maintenance Mode Start from the Function drop-down.
3. Enter @computerid@ in the ComputerID field.
4. Enter 120 in the Duration field.
5. Click Save Step to save this step and close the window.
418
Offline Backup
Performs a LabTech offline backup when the File Path parameter specifies the folder to backup.
In this case, the File Filter parameter is ignored and the backup will include all file types. The My
Documents folder backup is disabled and the File Filter parameter is ignored. If left empty, the files
in the My Documents folder of the logged on user will be backed up (at least one file extension must
be defined in the File Filter parameter).
In both cases the files in the folder will be backed up in reverse chronological order until the size of
the archive is larger than the value specified in the File Size parameter. The archive file will be
stored on an FTP server in the folder specified in the FTP Directory parameter. The FTP server
information (Server Address, Username, Password and Initial Directory) must be configured
on the Dashboard > Config > Outlook & Backup tab.
This function runs on the server.
Parameters
o
FTPDirectory:Initial directory on the FTPserver
File Password: Password for the zip archive
File Size: Enter the maximum size to make the archive. When the archive exceeds this
value, no further files will be added.
File Path: Enter the full path to the backup. The My Documents folder backup is disabled
and the File Filter parameter is ignored. If left empty, the files in the My Documents folder of
the logged on user will be backed up (at least one file extension must be defined in the File
Filter parameter).
File Filter:If a full path to the backup was entered in the File Path, this parameter is
ignored. This parameter is required if a full path was not entered in the File Path parameter.
If more than one extension is specified, the extensions must be separated by commas.
Examples
Example #1: Performs an offline backup of the %tempdir%\LTSGfolder on a remote computer.
Parameters:
o
FTPDirectory: @LTSG_FTPFolder@
File Password: @LTSG_Password@
File Size: 10
File Path: @tempdir\LTSG
File Filter:
Using the function examples in a new or existing script :
420
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Offline Backup from the Function drop-down.
3. Enter @LTSG_FTPFolder@ in the FTP Directory field.
4. Enter @LTSG_Password@ in the File Password field.
5. Enter 10 in the File Size field.
6. Enter @tempdir\LTSG in the File Path field.
7. Leave the File Filter field blank.
8. Click Save Step to save this step and close the window.
Example #2: Performs a backup of the .docx and .xlsx files in the My Documents folder of the
logged on user on the remote computer.
Parameters:
o
FTPDirectory: @LTSG_FTPFolder@
File Password: @LTSG_Password@
File Size: 10
File Path:
File Filter:*.docx,*.xlsx
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Offline Backup from the Function drop-down.
3. Enter @LTSG_FTPFolder@ in the FTP Directory field.
4. Enter @LTSG_Password@ in the File Password field.
5. Enter 10 in the File Size field.
6. Leave the File Path field blank.
7. Enter *.docx,*.xlsx in the File Filter field.
8. Click Save Step to save this step and close the window.
422
Patch Approve
Approves all security patches for the group selected. This function runs on the server.
Parameters
o
Group Name:Select the group to approve patches on from the drop-down. The list of
groups is retrieved from the database.
Examples
Example #1: Approves all security patches for agents that are members of the Service Plans.Windows Servers.Managed 24x7 group.
Parameters:
o
Group Name:Service Plans.Windows Servers.Managed 24x7
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Patch Approve from the Function drop-down.
3. Select Service Plans.Windows Servers.Managed 24x7 from the Group Name dropdown.
4. Click Save Step to save this step and close this window.
424
Patch Install
Installs a patch on the current computer. This function runs on the agent.
Parameters
o
Patch ID:Select the patch to install from the drop-down. The list of patches is retrieved from
the database.
Examples
Example #1: Installs the 2007 Microsoft Office Suite Service Pack 1 (SP1) patch on the current
computer.
Parameters:
o
Patch ID:2007 Microsoft Office Suite Service Pack 1 (SP1)
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Patch Install from the Function drop-down.
3. Select 2007 Microsoft Office Suite Service Pack 1 (SP1) from the Patch ID drop-down.
4. Click Save Step to save this step and close this window.
426
Patch Install All
Deploys Windows Updates to the current computer. This function runs on the agent.
Parameters
o
Action:Select the action to perform from the drop-down. Available options are:All Missing
Patches, Missing Security Patches and Missing Approved Patches.
Script ID:Script ID of the script to run on completion of the patch install.The script IDcan be
found to the right of the script name in parentheses after turning on Show ID's (Tools
>Show ID's).
Examples
Example #1: Installs all missing patches on the current computer
Parameters:
o
Action:All Missing Patches
Script ID:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Patch Install All from the Function drop-down.
3. Select All Missing Patches form the Action drop-down.
4. Leave the Script ID field blank.
5. Click Save Step to save this step and close this window.
Example #2: Installs all missing security patches on the current computer
Parameters:
o
Action:Missing Security Patches
Script ID:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Patch Install All from the Function drop-down.
3. Select Missing Security Patches from the Action drop-down.
4. Leave the Script ID field blank.
5. Click Save Step to save this step and close this window.
428
Example #3: Installs all missing approved patches on the current computer
Parameters:
o
Action:Missing Approved Patches
Script ID:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Patch Install All from the Function drop-down.
3. Select Missing Approved Patches from the Action drop-down.
4. Leave the Script ID field blank for this example.
5. Click Save Step to save this step and close this window.
430
Virus Definition Update
Runs a virus scanner update on the target computer (@computerid@) if the computer has a scanner installed with this ability. The command will fail if no scanner is detected. This function runs on
the agent.
Parameters
o
None
Examples
Example #1: Updates virus definitions on the target computer
Parameters:
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Virus Definition Update from the Function drop-down.
3. Click Save Step to save this step and close this window.
432
Virus Scan
Runs a virus scan on the target computer's system drive (@computerid@) if the computer has a
scanner installed with this ability. The command will fail if no scanner is detected. This function runs
on the agent.
Parameters
o
Path: Enter /fullscan or /quickscan (depends on command line options available in the antivirus software installed on the target computer. This must be configured in the Dashboard
(Dashboard >Config>Configuration >Virus Scan).
Examples
Example #1: Performs a virus scan on the %tempdir% folder of the target computer.
Parameters:
o
Path:%tempdir%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Virus Scan from the Function drop-down.
3. Enter %tempdir% in the Path field.
4. Click Save Step to save this step and close the window.
434
Windows Update Settings - Disable Access to Windows Update
Prevents the user from changing Windows Update settings or initiating a Windows Update session.This function runs on the agent.
Parameters
o
Action: Select Disable Access to Windows Update from the drop-down.
WSUSor Time: N/A
Examples
Example #1: Disables access to Windows Update
Parameters:
o
Action: Disables Access to Windows Update
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Disable Access to Windows Update from the Action drop-down.
4. Leave the WSUS or Time field blank for this example.
5. Click Save Step to save this step and close this window.
436
Windows Update Settings - Disable Windows Updates
Configures Windows to prevent Windows Updates. This function runs on the agent.
Parameters
o
Action: Select Disable Windows Update from the drop-down.
WSUSor Time: N/A
Examples
Example #1: Disables Windows Update
Parameters:
o
Action: Disables Windows Update
WSUSor Time:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Disable Windows Update from the Action drop-down.
4. Leave the WSUS or Time field blank for this example.
5. Click Save Step to save this step and close this window.
438
Windows Update Settings - Enable Windows Update Time
Configures Automatic Updates to occur everyday or a specified day of the week at a specified time.
This function runs on the agent.
Parameters
o
Action: Select Enable Windows Update at Time from the drop-down.
WSUSor Time: Enter scheduled time in 'Day:Time' format. Enter a 0 for the Day value or a
value of 1-7 for Sunday through Saturday. Enter 0-23 for the time.
Examples
Example #1: Schedules Windows Updates to occur everyday at 2:00 AM
Parameters:
o
Action: Enable Windows Update at Time
WSUSor Time: 0:2
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Enable Windows Update at Time from the Action drop-down.
4. Enter 0:2 in the WSUS or Time field.
5. Click Save Step to save this step and close this window.
Example #2: Schedules Windows Updates to occur every Tuesday at 6:00 PM
Parameters:
o
Action: Enable Windows Update at Time
WSUSor Time: 3:18
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Enable Windows Update at Time from the Action drop-down.
4. Enter 3:18 in the WSUS or Time field.
5. Click Save Step to save this step and close this window.
440
Windows Update Settings - Force Windows Update
Directs the Windows Update Agent to check for updates. This function runs on the agent.
Parameters
o
Action: Select Force Windows Update from the drop-down.
WSUSor Time: N/A
Examples
Example #1: Forces the Windows Update Agent to check for updates.
Parameters:
o
Action: Force Windows Update
WSUSor Time:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Force Windows Update from the Action drop-down.
4. Leave the WSUS or Time field blank for this example.
5. Click Save Step to save this step and close this window.
442
Windows Update Settings - Install Windows Update Agent
Installs the Windows Update Agent on the target computer. This function runs on the agent.
Parameters
o
Action: Select Install WUA Agent from the drop-down.
WSUSor Time: N/A
Examples
Example #1: Disables Windows Update
Parameters:
o
Action: Installs the Windows Update Agent on the target computer.
WSUSor Time:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Install WUA Agent from the Action drop-down.
4. Leave the WSUS or Time field blank for this example.
5. Click Save Step to save this step and close this window.
444
Windows Update Settings - Restore Defaults
Restores Windows Update settings to default values. (enables Automatic Updates, disables the
use of Windows Update Server and schedules updates everyday at 3:00 AM). This function runs
on the agent.
Parameters
o
Action: Select Restore Defaults from the drop-down.
WSUSor Time: N/A
Examples
Example #1: Restores the Windows Update default settings on the target computer.
Parameters:
o
Action: Restore Defaults
WSUSor Time:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Restore Defaults from the Action drop-down.
4. Leave the WSUS or Time field blank for this example.
5. Click Save Step to save this step and close this window.
446
Windows Update Settings - Set LabTech Mode
Configures the target computer to use LabTech to manage Windows Updates. This function runs
on the agent.
Parameters
o
Action: Select Set LabTech Mode from the drop-down.
WSUSor Time: N/A
Examples
Example #1: Sets LabTech mode
Parameters:
o
Action: Set LabTechMode
WSUSor Time:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Set LabTech Mode from the Action drop-down.
4. Leave the WSUS or Time field blank for this example.
5. Click Save Step to save this step and close this window.
448
Windows Update Settings - Set WSUS Server
Configures Windows to use the Windows Server Update Service. (enables Automatic Updates,
enables the use of Windows Update Server and sets the Windows Update Server URL or IP
Address.. This function runs on the agent.
Parameters
o
Action: Select Set WSUSServer from the drop-down.
WSUSor Time: Enter the Windows Update Server IP address or URL (without prefixing
the http:// protocol)
Examples
Example #1: Configures a WSUS server to manage Windows Updates using an IPaddress.
Parameters:
o
Action: Set WSUS Server
WSUSor Time: 192.168.10.30
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Set WSUS Server from the Action drop-down.
4. Enter 192.168.10.30 in the WSUS or Time field.
5. Click Save Step to save this step and close this window.
450
Example #2: Configures a WSUS server to manage Windows Updates using a URL
Parameters:
o
Action: Set WSUS Server
WSUSor Time: WSUS.LTSG.local
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Set WSUS Server from the Action drop-down.
4. Enter WSUS.LTSG.local in the WSUS or Time field.
5. Click Save Step to save this step and close this window.
452
Windows Update Settings - Windows Update Download Only
Configures Windows to only download updates. This function runs on the agent.
Parameters
o
Action: Select Windows Update Download Only from the drop-down.
WSUSor Time: N/A
Examples
Example #1: Configures Windows to only download updates.
Parameters:
o
Action: Windows Update Download Only
WSUSor Time:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Windows Update Settings from the Function drop-down.
3. Select Windows Update Download Only from the Action drop-down.
4. Leave the WSUS or Time field blank.
5. Click Save Step to save this step and close this window.
454
CHAPTER 11
Mobile Command Functions
This chapter provides parameter information, as well as examples for the various Mobile Command
functions available within LabTech.
Mobile Command - Generic Command
456
Mobile Command - Mobile Device Lock
459
Mobile Command - Mobile Device Wipe
461
Mobile Command - Require New Password
463
Mobile Command - Reset Password
465
Mobile Command - Set New Password
467
Mobile Command - Set Roaming
469
Mobile Command - Generic Command
Runs a mobile command. This function runs on the agent.
Parameters
o
Command: Numerical command to execute
Parameters: Any parameters needed for the command
Group List: Comma separated list of Group IDs. This parameter must be left blank if specifying a value in the ID field below
ID: IDof object to run against
IDType: Select the type of object from the drop-down. The available options are:Mobile
Device, Location or Client).
Examples
Example #1: Runs a mobile command on a specific mobile device. This function example
assumes that you have created LTSG_MobileDeviceCommandNumber and LTSG_
MobileDeviceParameter variables using the Variable Set function.
Parameters:
o
Command: @LTSG_MobileDeviceCommandNumber@
Parameters: @LTSG_MobileDeviceParameters@
Group List:
ID: @LTSG_MobileDeviceID@
IDType: Mobile Device
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Mobile Command: generic Command from the Function drop-down.
3. Enter @LTSG_MobileDeviceCommandNumber@ into the Command field.
4. Enter @LTSG_MobileDeviceParameters@ into the Parameters field.
5. Leave the Group field blank.
6. Enter @LTSG_MobileDeviceID@ into the ID field.
7. Select Mobile Device from the ID Type drop-down.
8. Click Save Step to save this step and close the window.
456
Example #2: Runs a mobile command on a group. This function example assumes that you have
created LTSG_MobileDeviceCommandNumber and LTSG_MobileDeviceParameter variables
using the Variable Set function.
Parameters:
o
Command: @LTSG_MobileDeviceCommandNumber@
Parameters: @LTSG_MobileDeviceParameters@
Group List: @LTSG_GroupOneID@,@LTSG_GroupTwoID@
ID:
IDType: Mobile Device
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Mobile Command: generic Command from the Function drop-down.
3. Enter @LTSG_MobileDeviceCommandNumber@ into the Command field.
4. Enter @LTSG_MobileDeviceParameters@ into the Parameters field.
5. Enter @LTSG_GroupOneID@,@LTSG_GroupTwoID@ into the Group List field.
6. Leave ID field blank.
7. Select Mobile Device from the ID Type drop-down.
8. Click Save Step to save this step and close the window.
458
Mobile Command - Mobile Device Lock
Runs a mobile command to lock the mobile device. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Locks the targeted mobile device
Parameters:
o
None
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Mobile Command: Mobile Device Lock from the Function drop-down.
3. Click Save Step to save this step and close the window.
460
Mobile Command - Mobile Device Wipe
Runs a mobile command to wipe mobile device data. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Runs a mobile command on a specific mobile device to wipe mobile device data.
Parameters:
o
None
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Mobile Command: Mobile Device Wipe from the Function drop-down.
3. Click Save Step to save this step and close the window.
462
Mobile Command - Require New Password
Runs a mobile command to require a new password be set on the mobile device. This function runs
on the agent.
Parameters
o
None
Examples
Example #1: Requires a new password be set on the mobile device
Parameters:
o
None
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Mobile Command: Require New Password from the Function drop-down.
3. Click Save Step to save this step and close the window.
464
Mobile Command - Reset Password
Runs a mobile command to reset the mobile device password. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Resets the password on the mobile device.
Parameters:
o
None
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Mobile Command: Reset Password from the Function drop-down.
3. Click Save Step to save this step and close the window.
466
Mobile Command - Set New Password
Runs a mobile command to set a new mobile device password. This function runs on the agent.
Parameters
o
Password:Password to set
Examples
Example #1: Sets a new password on the mobile device.This function example assumes that you
have created an LTSG_Password variable using the Variable Set function with the password in the
Parameter field.
Parameters:
o
Password:@LTSG_Password@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Mobile Command: Set New Password from the Function drop-down.
3. Click Save Step to save this step and close the window.
468
Mobile Command - Set Roaming
Runs a mobile command to set mobile device voice and dating roaming. This function runs on the
agent.
Parameters
o
Voice Roaming:Select the action from the drop-down. Available options are:Disabled,
Enabled and Do not alter
Data Roaming:Select the action from the drop-down. Available options are:Disabled,
Enabled and Do not alter
Examples
Example #1: Sets voice roaming to 'Disabled' and data roaming to 'Enabled'
Parameters:
o
Voice Roaming:Disabled
Data Roaming:Enabled
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Mobile Command: Set Roaming from the Function drop-down.
3. Select Disabled from the Voice Roaming drop-down.
4. Select Enabled from the Data Roaming drop-down.
5. Click Save Step to save this step and close the window.
CHAPTER
11
NetworkDevice Functions
This chapter provides parameter information, as well as examples for the various network device functions
available within LabTech.
Network Device - Check Connectivity
471
Index of Topics in Network Device Functions
472
470
NetworkDevice Functions
473
Network Device Get SNMP OID
473
Network Device - Set SNMP OID
474
Network Device SSH Close
476
Network Device SSHOpen
477
Network Device - SSH Send Raw
479
Network Device SSH Send Secure
481
Network Device - Telnet Close
482
Network Device - Telnet Open
483
Network Device - Telnet Send Raw
485
Network Device - Telnet Send Secure
487
Network Device - Ticket Create
488
Network Device - Check Connectivity
Pings the network device and saves the result in %=pingresult%=.
Parameters
o
None
Examples
Example #1: Pings the IP address of a network device.
Parameters:
o
None
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Check Connectivity from the Function drop-down.
3. Click Save Step to save this step and close the window.
Index of Topics in Network Device Functions
See below for a list of topics.
n
Network Device - Check Connectivity
Network Device Get SNMP OID
Network Device - Set SNMP OID
Network Device SSH Close
Network Device SSHOpen
Network Device - SSH Send Raw
Network Device SSH Send Secure
Network Device - Telnet Close
Network Device - Telnet Open
Network Device - Telnet Send Raw
472
Network Device - Telnet Send Secure
Network Device - Ticket Create
NetworkDevice Functions
This chapter provides parameter information, as well as examples for the various network device functions
available within LabTech.
Network Device Get SNMP OID
Gets a SNMP Object Identifier (OID) and saves result to variable.
Parameters
o
OID to retrieve: Enter the numeric object identifier.
Variable to store result in: Enter variable name without the @ sign.
Examples
Example #1: Retrieve the severity setting for events logged in the SysLog of a Cisco router. This
example assumes you have set a variable named @LTSG_ObjectID@ with the parameter
1.3.6.1.4.1.9.9.41.1.1.3.0.
Parameters:
o
OID to retrieve: @LTSG_ObjectID@.
Variable to store result in: LTSG_SNMPResult
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Get SNMP OID from the Function drop-down.
3. Enter @LTSG_ObjectID@ into the OID to retrieve field.
4. Enter LTSG_SNMPResult into the Variable to store result in field.
5. Click Save Step to save this step and close the window.
Network Device - Set SNMP OID
Set a SNMP Object Identifier (OID) to a value.
Parameters
o
OID to set: The numeric OID to set.
Data Type (Selection: String, Integer): The data type.
Data: The value to set the OID to.
Examples
Example #1: Set the severity setting for events logged in the SysLog of a Cisco router. This
example assumes you have set a variable named @LTSG_ObjectID@ with the parameter
1.3.6.1.4.1.9.9.41.1.1.3.0. and one named @LTSG_SNMPValue@ with a parameter of 4.
Parameters:
474
OID to set: @LTSG_ObjectID@
Data Type (Selection: String, Integer): String
Data: @LTSG_SNMPValue@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Set SNMP OID from the Function drop-down.
3. Enter @LTSG_ObjectID@ into the OID to set field.
4. Enter String into the Data Type (Selection: String, Integer) field.
5. Enter @LTSG_SNMPValue@ into the Data field.
6. Click Save Step to save this step and close the window.
Network Device SSH Close
Terminates an existing SSH session. Returns the following replacement variables:
%=sshsuccess%= The state of the operation, 1 for success and 0 for failure.
%=sshresult%= The result of the operation defined by the SSH server.
Parameters
o
SSHSession ID: The session ID of the open SSH connection to close.
Examples
Example #1: This example terminates an SSH connection to a network device. The examples
assumes you have set the variables
@SSHLogonName@ and @SSHPassword@ with proper SSH logon credentials for a network
device.
Parameters:
o
SSHSession ID: %sshsessionid%
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - SSHClose from the Function drop-down.
3. Enter %sshsessionid% into the SSHSession ID field.
4. Click Save Step to save this step and close the window.
476
Network Device SSHOpen
Establishes a connection to the SSH server on a network device using the SSH protocol. Returns
the following replacement variables:
o
%=sshsessionid%= The Session ID.
%=sshsuccess%= The state of the operation, 1 for success and 0 for failure.
%=sshresult%= The result of the operation defined by the SSH server.
Parameters
o
Port: The port to use for SSHcommunication (e.g., 22)
Timeout: Length of the timeout period in minutes.
Username: Username for accessing the device over SSH.
Password: Password for accessing device over SSH.
Examples
Example #1: This example opens an SSH connection to a network device. The examples
assumes you have set the variables
@SSHLogonName@ and @SSHPassword@ with proper SSH logon credentials for a network
device.
Parameters:
o
Port: 22
Timeout: 15
Username: @SSHLogonName@
Password: @SSHPassword@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - SSHOpen from the Function drop-down.
3. Enter 22 into the Port field.
4. Enter 15 into the Tiemout field.
5. Enter @SSHLogonName@ into the username field.
6. Enter @SSHPassword@ into the Password field.
7. Click Save Step to save this step and close the window.
478
Network Device - SSH Send Raw
Sends unencrypted data to a network device that has an open Telnet connection. Returns the following replacement variables:
%=sshsuccess%= The state of the operation, 1 for success and 0 for failure.
%=sshresult%= The result of the operation defined by the SSH server.
Parameters
o
Telnet Session ID: Session ID of the open SSH connection.
Text To Send: Text to send to the device.
Examples
Example #1: This example sends raw data to a network device. The examples assumes you have
set the variable
@LTSG_TelnetMessage@ with a message.
Parameters:
o
Telnet Session ID: %telnetsessionid%
Text To Send: @LTSG_TelnetMessage@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - SSHSend Raw from the Function drop-down.
3. Enter %telnetsessionid% into the SSH Session ID field.
4. Enter @LTSG_TelnetMessage@ into the Text To Send field.
5. Click Save Step to save this step and close the window.
480
Network Device SSH Send Secure
Sends encrypted data to a network device that has an open SSH connection. Returns the following
replacement variables:
%=sshsuccess%= The state of the operation, 1 for success and 0 for failure.
%=sshresult%= The result of the operation defined by the SSH server.
Parameters
o
SSH Session ID: Session ID of the open SSH connection.
Text To Send: Text to send to the device.
Examples
Example #1: This example sends encrypted data to a network device. The examples assumes
you have set the variable
@LTSG_SSHMessage@ with a message.
Parameters:
o
SSH Session ID: %sshsessionid%
Text To Send: @LTSG_SSHMessage@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - SSHSend Secure from the Function drop-down.
3. Enter %sshsessionid% into the SSH Session ID field.
4. Enter @LTSG_SSHMessage@ into the Text To Send field.
5. Click Save Step to save this step and close the window.
Network Device - Telnet Close
Terminates an existing Telnet session. Returns the following replacement variables:
%=telnetsuccess%= The state of the operation, 1 for success and 0 for failure.
%=telnetresult%= The result of the operation defined by the telnet server.
Parameters
o
TelnetSession ID: The session ID of the open Telnet connection to close.
Examples
Example #1: This example terminates a Telnet connection to a network device.
Parameters:
o
telnetSession ID: %telnetsessionid%
Using the function example in a new or existing script :
482
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Telnet Close from the Function drop-down.
3. Enter %telnetsessionid% into the TelnetSession ID field.
4. Click Save Step to save this step and close the window.
Network Device - Telnet Open
Establishes a connection to the telnet server on a network device using the Telnet protocol.
Returns the following replacement variables:
%=telnetsessionid%= The Session ID.
%=telnetsuccess%= The state of the operation, 1 for success and 0 for failure.
%=telnetresult%= The result of the operation defined by the telnet server.
Parameters
o
Port: The port to use for Telnetcommunication (e.g., 23)
Timeout: Length of the timeout period in minutes.
Examples
Example #1: This example opens a Telnet connection to a network device.
Parameters:
o
Port: 23
Timeout: 15
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Telnet Open from the Function drop-down.
3. Enter 23 into the Port field.
4. Enter 15 into the Timeout field.
5. Click Save Step to save this step and close the window.
484
Network Device - Telnet Send Raw
Sends unencrypted data to a network device that has an open SSH connection. Returns the following replacement variables:
%=telnetsuccess%= The state of the operation, 1 for success and 0 for failure.
%=telnetresult%= The result of the operation defined by the SSH server.
Parameters
o
Telnet Session ID: Session ID of the open SSH connection.
Text To Send: Text to send to the device.
Examples
Example #1: This example sends raw data to a network device. The examples assumes you have
set the variable
@LTSG_TelnetMessage@ with a message.
Parameters:
o
Telnet Session ID: %sshsessionid%
Text To Send: @LTSG_SSHMessage@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Telnet Send Raw from the Function drop-down.
3. Enter %telnetsessionid% into the Telnet Session ID field.
4. Enter @LTSG_TelnetMessage@ into the Text To Send field.
5. Click Save Step to save this step and close the window.
486
Network Device - Telnet Send Secure
Sends encrypted data to a network device that has an open Telnet connection. Returns the following replacement variables:
%=telnetsuccess%= The state of the operation, 1 for success and 0 for failure.
%=telnetresult%= The result of the operation defined by the SSH server.
Parameters
o
Telnet Session ID: Session ID of the open SSH connection.
Text To Send: Text to send to the device.
Examples
Example #1: This example sends encrypted data to a network device. The examples assumes
you have set the variable
@LTSG_TelnetMessage@ with a message.
Parameters:
o
Telnet Session ID: %telnetsessionid%
Text To Send: @LTSG_TelnetMessage@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Telnet Send Secure from the Function drop-down.
3. Enter %telnetsessionid% into the Telnet Session ID field.
4. Enter @LTSG_TelnetMessage@ into the Text To Send field.
5. Click Save Step to save this step and close the window.
Network Device - Ticket Create
Creates a new support ticket and saves the ticket ID to the %ticketid% variable. This function runs
on the server.
Parameters
o
Client ID: The Client ID to link ticket to.
Device ID: The Device ID to link the ticket to.
Email: The email address of ticket requestor.
Subject: The subject of the ticket.
Body: The message to include as the body.
Examples
Example #1: This example creates a new ticket for a network device. This example assumes you
have used the Set Variable function to create a variable named @deviceid@ with the ID of a
488
network device.
Parameters:
o
Client ID: %clientid%
Device ID: @deviceid@
Email: [email protected]
Subject: Sample Ticket
Body: This is a sample ticket for training.
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Network Device - Ticket Create from the Function drop-down.
3. Enter %clientid% into the Client ID field.
4. Enter @deviceid@ into the Device ID field.
5. Enter
[email protected] into the Email field.
6. Enter Sample Ticket into the Subject field.
7. Enter This is a sample ticket for training. into the Body field.
8. Click Save Step to save this step and close the window.
490
CHAPTER 12
Network Functions
This chapter provides parameter information, as well as examples for the various Network
functions available within LabTech.
Net DNS Lookup
492
Net Get IP Port
494
Net Get SNMP
496
Net IP Config
498
Net Ping
499
New Renew IP
501
Net Set SNMP
502
Net TFTP Send
504
Net Wake on LAN
507
Net DNS Lookup
Performs a DNS Lookup on the remote computer and saves the result to %dnsresult%. This function runs on the agent.
Parameters
o
Host Name: The hostname or URL
Examples
Example #1: Performs a DNSlookup of an Internet server (e.g., Yahoo.com). This function
example assumes that you have created an LTSG_URLvariable with the hostname or URLset as
the Parameter in the Variable Set function.
Parameters:
o
Host Name: @LTSG_URL@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net DNS Lookup from the Function drop-down.
3. Enter @LTSG_URL@ in the Host Name field.
4. Click Save Step to save this step and close the window.
492
Net Get IP Port
Connects to an Internet protocol port and reads characters into %portresult%. This function runs
on the agent.
Parameters
o
Type: Select the protocol to use from the drop-down. Available options are:TCP and UDP
Host name:The hostname or IPaddress
Port: Port number to connect to
Data: Data to send after connecting, leave blank for none.
Receive Bytes: Number of bytes to receive, enter 0 to listen test.
Examples
Example #1: Listen for response when connecting to the FTP port of the LabTech server. This
function example assumes that you have created an LTSG_LabTechServerIP variable using the
Variable Set function.
Parameters:
o
Type: TCP
Host name:@LTSG_LabTechServerIP@
Port: 21
Data:
Receive Bytes: 0
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net Get IP Port from the Function drop-down.
3. Select TCP from the Type drop-down.
4. Enter @LTSG_LabTechServerIP@ in the Host name field.
5. Enter 21 in the Port field.
6. Leave the Data field blank for this example.
7. Enter 0 in the Receive Bytes field.
8. Click Save Step to save this step and close the window.
494
Net Get SNMP
Gets an SNMP Object Identifier (OID) and saves it to %snmpresult%. This function runs on the
agent.
Parameters
o
Host Name:The IPaddress or hostname
Community:The community string to use
OID:The numeric OIDto get
Examples
Example #1: Retrieves the severity setting for events logged in the SysLog of a Cisco router. This
function example assumes that you have created LTSG_NetworkDevice and LTSG_Community
variables using the Variable Set function.
Parameters:
o
Host Name:@LTSG_NetworkDevice@
Community:@LTSG_Community@
OID:@LTSG_ObjectID@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net Get SNMP from the Function drop-down.
3. Enter @LTSG_NetworkDevice@ in the Host Name field.
4. Enter @LTSG_Community@ in the Community field.
5. Enter @LTSG_ObjectID@ in the OID field.
6. Click Save Step to save this step and close the window.
496
Net IP Config
Returns the IPConfig information and saves it to %ipconfigresult%. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Retrieves the IPconfiguration data of the target computer
Parameters:
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net IPConfig from the Function drop-down.
3. Click Save Step to save this step and close the window.
498
Net Ping
Pings a hostname and saves the result in %pingresult%. This function runs on the agent.
Parameters
o
Host Name:The hostname or IPaddress
Examples
Example #1: Pings the IPaddress of an Internet server. This function example assumes that you
have created a LTSG_URL variable with a value of www.labtechsoftware.com.
Parameters:
o
Hostname:
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net Ping from the Function drop-down.
3. Enter @LTSG_URL@ in the Host Name field.
4. Click Save Step to save this step and close the window.
500
New Renew IP
Renews the remote computer's IPaddress. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Renews the DHCPaddress of the target computer
Parameters:
o
None
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net Renew IP from the Function drop-down.
3. Click Save Step to save this step and close the window.
Net Set SNMP
Sets an SNMP Object Identifier (OID)to a value. This function runs on the agent.
Parameters
o
Host Name:The IPaddress or DNSname
Community:The community of the device
OID:The numeric OIDto set
Value:The value to set the OID to
Examples
Example #1: Set the severity setting for events logged in the SysLog of a Cisco router.This function example assumes that you have created LTSG_NetworkDevice, LTSG_Community, LTSG_
ObjectID and LTSG_SNMPValue variables using the Variable Set function.
Parameters:
o
Host Name:@LTSG_NetworkDevice@
Community:@LTSG_Community@
OID:@LTSG_ObjectID@
Value:@LTSG_SNMPValue@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net Set SNMP from the Function drop-down.
3. Enter @LTSG_NetworkDevice@ in the Host Name field.
4. Enter @LTSG_Community@ in the Community field.
5. Enter @LTSG_ObjectID@ in the OID field.
6. Enter @LTSG_SNMPValue@ in the Value field.
7. Click Save Step to save this step and close the window.
502
Net TFTP Send
Sends a local TFTP file to a machine. This function runs on the agent.
Parameters
o
File Name:The file must exist in the %Windir%\LTSVC\TFTPdirectory, without quotes.
Server Address:The hostname or IPaddress
Examples
Example #1: Sends a file to the TFTP server on the LabTech server. This function example
assumes that you have created an LTSG_TFTPServerIPvariable using the Variable Set function.
File Copy as Admin Function
Parameters:
o
Source Path:%tempdir%\LTSG\LTSG_TFTPTestFile.txt
Destination Path:%LTSVCDIR%\TFTP\LTSG_TFTPTestFile.txt
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select File Copy as Admin from the Function drop-down.
3. Enter %tempdir%\LTSG\LTSG_TFTPTestFile.txt in the Source Path field.
4. Enter %LTSVCDIR%\TFTP\LTSG_TFTPTestFile.txt in the Destination Path field.
5. Click Save Step to save this step and close the window.
504
Net TFTPSend
Parameters:
o
File Name:LTSG_TFTPTestFile.txt
Server Address:@LTSG_TFTPServerIP@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net TFTP Send from the Function drop-down.
3. Enter LTSG_TFTPTestFile.txt in the File name field.
4. Enter @LTSG_TFTPServerIP@ in the Server Address field.
5. Click Save Step to save this step and close the window.
506
Net Wake on LAN
Sends Wake on LANpacket to a remote computer. This function runs on the agent.
Parameters
o
MAC:The MACaddress of the target computer. Use a colon (:)to separate values
Examples
Example #1: Sends a Wake on LANpacket to the computer with the machine address of
@[email protected] function example assumes that you have created an LTSG_ComputerMAC variable using the Variable Set function.
Net Wake on LAN
Parameters:
o
MAC:@LTSG_ComputerMAC@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Net Wake on Lan from the Function drop-down.
3. Enter @LTSG_ComputerMAC@ in the MAC field.
4. Click Save Step to save this step and close the window.
508
CHAPTER 13
Remote Management Functions
This chapter provides parameter information, as well as examples for the various Remote
Management functions available within LabTech.
Console Execute
510
Console Logoff User
515
Console Open Browser
520
Console Registry Read
525
Console Screen Capture
530
Console Shell
535
Console Show Message
540
SSH Close Connection
545
SSH Open Connection
549
SSH Send Raw
553
SSH Send Secure
557
Telnet Close Connection
561
Telnet Open Connection
565
Telnet Send Raw
569
Telnet Send Secure
573
Console Execute
Runs a program on the desktop of the logged on user. Use the 'IF Logged On to Test' function to
retrieve the console number of the user's session. This program has FULL access to the user's
desktop, network and environment. It returns data to %executeresult%. This function runs on the
agent.
Parameters
o
Executable: Full path to the program to run. Include in quotes
Arguments:Arguments passed to the executable
Console Number:Console number to run the program on, use %consolenumber% when
using the IFConsole Logged On function.
Examples
Example #1: Opens Notepad.exe on a user's desktop. The following function example assumes
that you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username: @user@
Steps to Skip: :RunConsoleExecute1
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Enter @user@ in the Username field.
4. Enter :RunConsoleExecute1 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
510
Script Log Message function
Parameters:
o
Message: User is NOTlogged on the server.
Script Note function (creates a RunConsoleExecute1 label for the script to jump to if the user is
logged on)
Parameters:
o
Remark: :RunConsoleExecute1
Console Execute function
Parameters:
o
Executable: Notepad.exe
Arguments:
Console Number:%consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Execute from the Function drop-down.
3. Enter Notepad.exe in the Executable field.
4. Leave the Arguments field blank for this example.
5. Enter %consolenumber% in the Console Number.
6. Click Save Step to save this step and close the window.
Example #2: Opens Notepad.exe on any user's desktop. The following function example assumes
that you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username:
Steps to Skip: :RunConsoleExecute2
Using the function examples in a new or existing script :
512
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Leave the Username field blank for this example.
4. Enter :RunConsoleExecute2 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
Script Note function (creates a RunConsoleExecute2 label for the script to jump to if any user is
logged on)
Parameters:
o
Remark: :RunConsoleExecute2
Console Execute function
Parameters:
Executable: Notepad.exe
Arguments:
Console Number:%consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Execute from the Function drop-down.
3. Enter Notepad.exe in the Executable field.
4. Leave the Arguments field blank for this example.
5. Enter %consolenumber% in the Console Number.
6. Click Save Step to save this step and close the window.
514
Console Logoff User
Logs the user off if the user is logged on. Use the 'IF Logged On to Test' function to retrieve the console number of the user's session.. This function runs on the agent.
Parameters
o
Console Number:Console number of user to log off, use %consolenumber% when using
the IFLogged on to Test function.
Examples
Example #1: Logs off a specific user on the console. The following function example assumes that
you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username: @user@
Steps to Skip: :RunConsoleLogOff1
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Enter @user@ in the Username field.
4. Enter :RunConsoleLogoff1 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message: User is NOTlogged on the server.
Script Note function (creates a RunConsoleLogOff1 label for the script to jump to if the user is
logged on)
Parameters:
o
Remark: :RunConsoleLogOff1
Console Logoff User function
Parameters:
o
Console Number:%consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
516
open the Edit Script Step window.
2. Select Console Logoff User from the Function drop-down.
3. Enter %consolenumber% in the Console Number field.
4. Click Save Step to save this step and close the window.
Example #2: Logs off the any user on the console. The following function example assumes that
you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username:
Steps to Skip: :RunConsoleLogOff2
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Enter @user@ in the Username field.
4. Enter :RunConsoleLogoff1 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
Script Note function (creates a RunConsoleLogOff2 label for the script to jump to if any user is
logged on)
Parameters:
o
Remark: :RunConsoleLogOff2
Console Logoff User function
Parameters:
o
Console Number:%consolenumber%
Using the function examples in a new or existing script :
518
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Logoff User from the Function drop-down.
3. Enter %consolenumber% in the Console Number field.
4. Click Save Step to save this step and close the window.
Console Open Browser
Opens the user's Internet Explorer to the specified address. Use the 'IF Logged On to Test' function to retrieve the console number of the user's session.This function runs on the agent.
Parameters
o
URL: Browser address to display
Console Number:Console number to display on. Use %consolenumber% when using the
IF Logged on to Test function.
Examples
Example #1: Opens a webpage in a user's browser. This function example assumes you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username: @user@
Steps to Skip: :RunConsoleOpenBrowser1
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Enter @user@ in the Username field.
4. Enter :RunConsoleOpenBrowser1 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
520
Script Note function (creates a RunConsoleOpenBrowser1 label for the script to jump to if the user
is logged on)
Parameters:
o
Remark: RunConsoleOpenBrowser1
Console Open Browser function
Parameters:
o
URL: www.labtechsoftware.com
Console Number: %consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Open Browser from the Function drop-down.
3. Enter www.labtechsoftware.com in the URL field.
4. Enter %consolenumber% in the Console Number field.
5. Click Save Step to save this step and close the window.
Example #2: Opens a webpage in any user's browser. This function example assumes you have
created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username:
Steps to Skip: :RunConsoleOpenBrowser2
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Leave the Username field blank.
522
4. Enter :RunConsoleOpenBrowser2 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
Script Note function (creates a RunConsoleOpenBrowser2 label for the script to jump to if any user
is logged on)
Parameters:
o
Remark: RunConsoleOpenBrowser2
Console Open Browser function
Parameters:
o
URL: www.labtechsoftware.com
Console Number: %consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Open Browser from the Function drop-down.
3. Enter www.labtechsoftware.com in the URL field.
4. Enter %consolenumber% in the Console Number field.
5. Click Save Step to save this step and close the window.
524
Console Registry Read
Reads a registry key or value and sets the %regresult% variable. Use the 'IF Logged On to Test'
function to retrieve the console number of the user's session. This function runs on the agent.
Parameters
o
Registry Key: The key or value to be read
Console Number:Console number to read key or value on, use %consolenumber% when
using the IFLogged on to Test function.
Examples
Example #1: Reads a registry key on the target computer from a user's environment. The following function example assumes that you have created a User variable using the Variable Set
function.
IFConsole Logged On function
Parameters:
o
Username: @user@
Steps to Skip: :RunConsoleReadRegistry1
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Enter @user@ in the Username field.
4. Enter :RunConsoleReadRegistry1 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message: User is NOTlogged on the server.
Script Note function (creates a RunConsoleReadRegistry1 label for the script to jump to if the user
is logged on)
Parameters:
o
Remark: :RunConsoleReadRegistry1
Console Registry Read function
Parameters:
o
Registry Key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AccountPicture\DisplayName
Console Number:%consolenumber%
Using the function examples in a new or existing script :
526
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Registry Read from the Function drop-down.
3. Enter HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AccountPicture\DisplayName in the
Registry Key field.
4. Enter %consolenumber% in the Console Number field.
5. Click Save Step to save this step and close the window.
Example #2: Reads a registry key on the target computer from any user's environment. The following function example assumes that you have created a User variable using the Variable Set
function.
IFConsole Logged On function
Parameters:
o
Username:
Steps to Skip: :RunConsoleReadRegistry2
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Leave the Username field blank for this example.
4. Enter :RunConsoleReadRegistry2 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
Script Note function (creates a RunConsoleReadRegistry2 label for the script to jump to if any user
is logged on)
Parameters:
o
Remark: :RunConsoleReadRegistry2
Console Read Registry function
Parameters:
528
Console Number:%consolenumber%
Registry Key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AccountPicture\DisplayName
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Registry Read from the Function drop-down.
3. Enter HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AccountPicture\DisplayName in the
Registry Key field.
4. Enter %consolenumber% in the Console Number field.
5. Click Save Step to save this step and close the window.
Console Screen Capture
Performs a screen capture on the user's console. Use the 'IF Logged On to Test' function to
retrieve the console number of the user's session. The screen capture is displayed on the Welcome tab of the Computer Management screen. This function runs on the agent.
Parameters
o
Console Number:Console number to capture the screen on
Examples
Example #1: Captures an image of the user's console. The following function example assumes
that you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username: @user@
Steps to Skip: :RunConsoleScreenCapture1
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Enter @user@ in the Username field.
4. Enter :RunConsoleScreenCapture1 in the Steps To Skip field
5. Click Save Step to save this step and close the window.
530
Script Log Message function
Parameters:
o
Message: User is NOTlogged on the server.
Script Note function (creates a RunConsoleScreenCapture1 label for the script to jump to if the
user is logged on)
Parameters:
o
Remark: :RunConsoleScreenCapture1
Console Screen Capture function
Parameters:
o
Console Number:%consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Screen Capture from the Function drop-down.
3. Enter %consolenumber% in the Console Number field.
4. Click Save Step to save this step and close the window.
Example #2: Captures an image of any user's console. The following function example assumes
that you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username:
Steps to Skip: :RunConsoleScreenCapture2
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
532
2. Select IF Console Logged On from the Function drop-down.
3. Leave the Username field blank.
4. Enter :RunConsoleScreenCapture2 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
Script Note function (creates a RunConsoleScreenCapture2 label for the script to jump to if any
user is logged on)
Parameters:
o
Remark: :RunConsoleScreenCapture2
Console ScreenCapture function
Parameters:
o
Console Number:%consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Screen Capture from the Function drop-down.
3. Enter %consolenumber% in the Console Number field.
4. Click Save Step to save this step and close the window.
534
Console Shell
Uses CMD.exe to execute a shell command in the background on the user's console. Use the 'IF
Logged On to Test' function to retrieve the console number of the user's session. Command has
limited access to the user environment. It returns command output to %shellresult%. This function
runs on the agent.
Parameters
o
Command: Commands to execute
Console Number:Console number, use %consolenumber% when using the IFLogged on
to Test function.
Examples
Example #1: Runs ipconfig.exe in background shell on a user's console. The following function
example assumes that you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username: @user@
Steps to Skip: :RunConsoleShell1
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Enter @user@ in the Username field.
4. Enter :RunConsoleShell1 in the Steps To Skip field
5. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message: User is NOTlogged on the server.
Script Note function (creates a RunConsoleShell1 label for the script to jump to if the user is logged
on)
Parameters:
o
Remark: :RunConsoleShell1
Console Shell function
Parameters:
o
Command: ipconfig /all
Console Number:%consolenumber%
Using the function examples in a new or existing script :
536
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Shell from the Function drop-down.
3. Enter ipconfig /all in the Command field.
4. Enter %consolenumber% in the Console Number field.
5. Click Save Step to save this step and close the window.
Example #2: Runs ipconfig.exe in background shell on any user's console. The following function
example assumes that you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username:
Steps to Skip: :RunConsoleShell2
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Leave the Username field blank for this example.
4. Enter :RunConsoleShell2 in the Steps To Skip field
5. Click Save Step to save this step and close the window.
Script Note function (creates a RunConsoleShell2 label for the script to jump to if any user is
logged on)
Parameters:
o
Remark: :RunConsoleShell2
Console Shell function
Parameters:
538
Command: ipconfig /all
Console Number:%consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Shell from the Function drop-down.
3. Enter ipconfig /all in the Command field.
4. Enter %consolenumber% in the Console Number field.
5. Click Save Step to save this step and close the window.
Console Show Message
Displays a pop-up message on the user's desktop, if the user is logged on. Use the 'IF Logged On
to Test' function to retrieve the console number of the user's session.. This function runs on the
agent.
Parameters
o
Message: The message to display on the desktop
Console Number:Console number, use %consolenumber% when using the IFLogged on
to Test function.
Examples
Example #1: Displays a popup message on a user's console. The following function example
assumes that you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username: @user@
Steps to Skip: :RunConsoleShowMessage1
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Enter @user@ in the Username field.
4. Enter :RunConsoleShowMessage1 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
540
Script Log Message function
Parameters:
o
Message: User is NOTlogged on the server.
Script Note function (creates a RunConsoleShowMessage1 label for the script to jump to if the
user is logged on)
Parameters:
o
Remark: :RunConsoleShowMessage1
Console Show Message function
Parameters:
o
Message: Prepare to Be Automated!
Console Number:%consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Show Message from the Function drop-down.
3. Enter Prepare to Be Automated! in the Message field.
4. Enter %consolenumber% in the Console Number field.
5. Click Save Step to save this step and close the window.
Example #2: Displays a pop-up message on any user's console. The following function example
assumes that you have created a User variable using the Variable Set function.
IFConsole Logged On function
Parameters:
o
Username:
Steps to Skip: :RunConsoleShowMessage2
Using the function examples in a new or existing script :
542
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select IF Console Logged On from the Function drop-down.
3. Leave the Username field blank.
4. Enter :RunConsoleShowMessage2 in the Steps To Skip field.
5. Click Save Step to save this step and close the window.
Script Note function (creates a RunConsoleShowMessage2 label for the script to jump to if any
user is logged on)
Parameters:
o
Remark: :RunConsoleShowMessage2
Console Show Message function
Parameters:
Message: Prepare to Be Automated!
Console Number:%consolenumber%
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Console Show Message from the Function drop-down.
3. Enter Prepare to Be Automated! in the Message field.
4. Enter %consolenumber% in the Console Number field.
5. Click Save Step to save this step and close the window.
544
SSH Close Connection
Closes an existing SSH session. This function runs on the server. It returns the following replacement variables:
o
%sshsuccess%: The state of the operation, 1 for success and 0 for failure.
%sshresult%: The result of the operation defined by the telnet server.
Parameters
o
SSH Session ID: Session ID of the open SSH connection. The %sshsessionid% variable is
a system variable that is created and populated when an ssh session is opened.
Examples
Example #1: Closes an SSHconnection to a device.
SSH Close Connection function
Parameters:
o
SSH Session ID: @sshsessionid@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SSH Close Connection from the Function drop-down.
3. Enter @sshsessionid@ in the SSH Session ID field.
4. Click Save Step to save this step and close the window.
Variable Check function
Parameters:
o
Variable Name:%sshsuccess%
Compare:>
To:0
Steps to Skip: :SSHConnectionClosed
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter %sshsuccess% in the Variable Name field.
4. Select > from the Compare drop-down.
5. Enter 0 in the To field.
6. Enter :SSHConnectionClosed in the Steps to Skip field.
546
7. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message:Unable to close an SSH connection on @SSHdevice@
Script Log Message function
Parameters:
o
Message:Response from trying to close an SSH connection is %sshresult%.
Script Note function
Parameters:
o
Remark::SSHConnectionClosed
Script Log Message function (SSHConnectionClosed label)
Parameters:
548
Message:%sshresult%
SSH Open Connection
Establishes a connection to the SSH server on a remote device using the SSH protocol. This function runs on the server. It returns the following replacement variables:
o
%sshsessionid%: The Session ID.
%sshsuccess%: The state of the operation, 1 for success and 0 for failure.
%sshresult%: The result of the operation defined by the SSH server.
Parameters
o
Hostname: Hostname or IP address of the device
Port: Port to use
Timeout:Timeout period (minutes)
Username: SSHusername
Password:SSHpassword
Examples
Example #1: Opens an SSH connection to a device. This function example assumes that you
have created SSHdevice, SSHLogonName and SSHPassword variables using the Variable Set
function.
SSH Open Connection function
Parameters:
o
Hostname: @SSHdevice@
Port: 22
Timeout:15
Username:@SSHLogonName@
Password: @SSHPassword@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SSH Open Connection from the Function drop-down.
3. Enter @SSHdevice@ in the Hostname field.
4. Enter 22 in the Port field.
5. Enter 15 in the Timeout field.
6. Enter @SSHLogonName@ in the Username field.
7. Enter @SSHPassword@ in the Password field.
8. Click Save Step to save this step and close the window.
Variable Check function
Parameters:
o
Variable Name:%sshsuccess%
Compare:>
To:0
Steps to Skip: :SSHConnectionEstablished
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
550
2. Select Variable Check from the Function drop-down.
3. Enter %sshsuccess% in the Variable Name field.
4. Select > from the Compare field.
5. Enter 0 in the To field.
6. Enter :SSHConnectionEstablished in the Steps to Skip field.
7. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message:Unable to make an SSH connection to @SSHdevice@
Script Log Message function
Parameters:
o
Message:Response from trying to make an SSH connection to %sshresult%
Script Note function
Parameters:
o
Remark::SSHConnectionEstablished
Script Log Message function (SSHConnection Established label)
Parameters:
o
552
Message:%sshresult%
SSH Send Raw
Sends unencrypted data to a remote device that has an open SSH connection. This function runs
on the server. It returns the following replacement variables:
o
%sshsuccess%: The state of the operation, 1 for success and 0 for failure.
%sshresult%: The result of the operation defined by the telnet server.
Parameters
o
SSH Session ID: Session IDof the open SSH connection. The %sshsessionid% variable is
a system variable that is created and populated when an ssh session is opened.
Text To Send: Text to send to the device
Examples
Example #1: Sends raw data to an SSH server. The response is stored in %sshresult% and the
success state in %sshsuccess%.This function example assumes that you have created SSHdevice
and SSHLogonName variables using the Variable Set function.
SSHSend Raw function
Parameters:
o
SSH Session ID: %sshsessionid%
Text To Send: @SSHLogonName@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SSH Send Raw from the Function drop-down.
3. Enter %sshsessionid% in the SSH Session ID field.
4. Enter @SSHLogonName@ in the Text To Send field.
5. Click Save Step to save this step and close the window.
Variable Check function
Parameters:
o
Variable Name: %sshsuccess%
Compare:>
To:0
Steps to Skip::SSHRawDataSent
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter %sshsuccess% in the Variable Name field.
4. Select > from the Compare drop-down.
5. Enter 0 in the To field.
6. Enter :SSHRawDataSent in the Steps to Skip field.
554
7. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message: Unable to send raw data to an SSH server on @SSHdevice@.
Script Log Message function
Parameters:
o
Message: Response from trying to send raw data to an SSH server is:@sshresult@.
Script Note function
Parameters:
o
Remark:SSHRawDataSent
Script Log Message function (SSHRawDataSent label)
Parameters:
556
Message:%sshresult%
SSH Send Secure
Sends encrypted data to a device that has an open SSH connection. This function runs on the
server. It returns the following replacement variables:
o
%sshsuccess%: The state of the operation, 1 for success and 0 for failure.
%sshresult%: The result of the operation defined by the telnet server.
Parameters
o
SSH Session ID: Session ID of the open SSH connection. The %sshsessionid% variable is
a system variable that is created and populated when an ssh session is opened.
Text to Send: Text to send to the device
Examples
Example #1: Sends encrypted data to an SSHserver. The response is stored in %sshresult% and
the success state in @sshsuccess%. This function example assumes that you have created
SSHdevice and SSHPassword variables using the Variable Set function.
SSH Send Secure function
Parameters:
o
SSH Session ID: %SSHsessionID%
Text to Send: @SSHPassword@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select SSH Send Secure from the Function drop-down.
3. Enter %sshsessionid% in the SSH Session ID field.
4. Enter @SSHPassword@ in the Text To Send field.
5. Click Save Step to save this step and close the window.
Variable Check function
Parameters:
o
Variable Name:%sshsuccess%
Compare:>
To:0
Steps to Skip: :SSHEncryptedDataSent
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter %sshsuccess% in the Variable Name field.
4. Select > from the Compare field.
5. Enter 0 in the To field.
6. Enter :SSHEncryptedDataSent in the Steps to Skip field.
558
7. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message:Unable to send encrypted data to an SSH server on @SSHdevice@
Script Log Message function
Parameters:
o
Message:Response from trying to send encrypted data to an SSHserver is:%sshresult%
Script Note function
Parameters:
o
Remark::SSHEncryptedDataSent
Script Log Message function (SSHEncryptedDataSent label)
Parameters:
560
Message:%sshresult%
Telnet Close Connection
Closes an existing Telnet session. This function runs on the server. It returns the following replacement variables:
o
%telnetsuccess%: The state of the operation, 1 for success and 0 for failure.
%telnetresult%: The result of the operation defined by the telnet server.
Parameters
o
Telnet Session ID: Session ID of the open Telnet connection. The %telnetsessionid% variable is a system variable that is created and populated when a telnet session is opened.
Examples
Example #1: Closes a Telnet connection to a device.
Telnet Close Connection function
Parameters:
o
Telnet Session ID: @telnetsessionid@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Telnet Close Connection from the Function drop-down.
3. Enter %telnetsessionid% in the Telnet Session ID field.
4. Click Save Step to save this step and close the window.
Variable Check function
Parameters:
o
Variable Name:%telnetsuccess%
Compare:>
To:0
Steps to Skip: :TelnetConnectionClosed
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter %telnetsuccess% in the Variable ID field.
4. Select > from the Compare drop-down.
5. Enter 0 in the To field.
6. Enter :TelnetConnectionClosed in the Steps to Skip field.
562
7. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message:Unable to close a Telnet connection on @Telnetdevice@
Script Log Message function
Parameters:
o
Message:Response from trying to close a Telnet connection is %telnetresult%.
Script Note function
Parameters:
o
Remark::TelnetConnectionClosed
Script Log Message function (TelnetConnectionClosed label)
Parameters:
564
Message:%telnetresult%
Telnet Open Connection
Establishes a connection to the Telnet server on a remote device using the Telnet protocol. This
function runs on the server. It returns the following replacement variables:
o
%telnetsessionid%: The Session ID.
%telnetsuccess%: The state of the operation, 1 for success and 0 for failure.
%telnetresult%: The result of the operation defined by the telnet server.
Parameters
o
Hostname: Hostname or IP address of the device
Port: Port to use
Timeout:Timeout period (minutes)
Examples
Example #1: Open a Telnet connection to a device and stores the session ID in %telnetsessionid%.The response is stored in %telnetresult% and the success state in %telnetsuccess%.This function example assumes that you have created a Telnetdevice variable using
the Variable Set function.
Telnet Open Connection function
Parameters:
o
Hostname: @Telnetdevice@
Port: 23
Timeout:15
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Telnet Open Connection from the Function drop-down.
3. Enter @Telnetdevice@ in the Hostname field.
4. Enter 23 in the Port field.
5. Enter 15 in the Timeout field.
6. Click Save Step to save this step and close the window.
Variable Check function
Parameters:
o
Variable Name:%telnetsuccess%
Compare:>
To:0
Steps to Skip: :TelnetConnectionEstablished
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter %telnetsuccess% in the Variable Name field.
4. Select > from the Compare drop-down.
5. Enter 0 in the To field.
6. Enter :TelnetConnectionEstablished in the Steps to Skip field.
566
7. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message:Unable to make a Telnet connection to @Telnetdevice@
Script Log Message function
Parameters:
o
Message:Response from trying to make a Telnet connection to %telnetresult%
Script Note function
Parameters:
o
Remark::TelnetRawDataSent
Script Log Message function (TelnetRawDataSent label)
Parameters:
568
Message:%telnetresult%
Telnet Send Raw
Sends unencrypted data to a remote device that has an open Telnet connection. This function runs
on the server. It returns the following replacement variables:
o
%telnetsuccess%: The state of the operation, 1 for success and 0 for failure.
%telnetresult%: The result of the operation defined by the telnet server.
Parameters
o
Telnet Session ID: Session IDof the open Telnet connection
Text To Send: Text to send to the device
Examples
Example #1: Sends raw data to a Telnet server. The response is stored in %telnetresult% and the
success state in %telnetsuccess%. This function example assumes that you have created Telnetdevice and TelNetLogonName variables using the Variable Set function.
TelnetSend Raw function
Parameters:
o
Telnet Session ID: %telnetsessionid%
Text To Send: @TelnetLogonName@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Telnet Send Raw from the Function drop-down.
3. Enter %telnetsessionid% in the Telnet Session ID field.
4. Enter @TelnetLogonName@ in the Text To Send field.
5. Click Save Step to save this step and close the window.
Variable Check function
Parameters:
o
Variable Name: %telnetsuccess%
Compare:>
To:0
Steps to Skip::TelnetRawDataSent
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter %telnetsuccess% in the Variable Name field.
4. Select > from the Compare drop-down.
5. Enter 0 in the To field.
6. Enter :TelnetRawDataSent in the Steps to Skip field.
570
7. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message: Unable to send raw data to a Telnet server on @Telnetdevice@.
Script Log Message function
Parameters:
o
Message: Response from trying to send raw data to a Telnet server is:@telnetresult@.
Script Note function
Parameters:
o
Remark::TelnetRawDataSent
Script Log Message function (TelnetRawDataSent label)
Parameters:
572
Message: %telnetresult%
Telnet Send Secure
Sends encrypted data to a device that has an open Telnet connection. This function runs on the
server. It returns the following replacement variables:
o
%telnetsuccess%: The state of the operation, 1 for success and 0 for failure.
%telnetresult%: The result of the operation defined by the telnet server.
Parameters
o
Telnet Session ID: Session ID of the open Telnet connection. The %telnetsessionid% variable is a system variable that is created and populated when a telnet session is opened.
Text to Send: Text to send to the device
Examples
Example #1: Sends encrypted data to a Telnet server. The response is stored in %telnetresult%
and the success state in @telnetsuccess%. This function example assumes that you have created
TelnetDevice and TelnetPassword variables using the Variable Set function.
Telnet Send Secure function
Parameters:
o
Telnet Session ID: %telnetsessionID%
Text to Send: @TelnetPassword@
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Telnet Send Secure from the Function drop-down.
3. Enter %telnetsessionid% in the Telnet Session ID field.
4. Enter @TelnetPassword@ in the Text to Send field.
5. Click Save Step to save this step and close the window.
Variable Check function
Parameters:
o
Variable Name:%telnetsuccess%
Compare:>
To:0
Steps to Skip: :TelnetEncryptedDataSent
Using the function examples in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter %telnetsuccess% in the Variable Name field.
4. Select > from the Compare drop-down.
5. Enter 0 in the To field.
6. Enter :TelnetEncryptedDataSent in the Steps to Skip field.
574
7. Click Save Step to save this step and close the window.
Script Log Message function
Parameters:
o
Message:Unable to send encrypted data to a Telnet server on @Telnetdevice@
Script Log Message function
Parameters:
o
Message:Response from trying to send encrypted data to a Telnet server
is:%telnetresult%
Script Note function
Parameters:
o
Remark::TelnetEncryptedDataSent
Script Log Message function (TelnetEncryptedDataSent label)
Parameters:
o
576
Message:%telnetresult%
CHAPTER 14
Resend Functions
This chapter provides parameter information, as well as examples for the various Resend functions
available within LabTech.
Resend Autostartup List
578
Resend Config
580
Resend Drive Info
581
Resend Error Logs
583
Resend Event Logs
584
Resend Everything
586
Resend Hardware
588
Resend Network Information
590
Resend Patch Information
592
Resend Printers
594
Resend Process List
595
Resend Service List
597
Resend Software
598
Resend System Information
600
Resend Autostartup List
Instructs the agent to perform a startup scan with the currently loaded definitions and registry values to update the following startup information: startup definition, name, value and file name. This
information is used to update the database and the Startup tab of the Computer Management
screen. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Autostartup List command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Autostartup List from the Function drop-down.
3. Click Save Step to save this step and close the window.
578
Resend Config
Updates the agent by instructing the agent to download the most current agent template, virus
definitions, startup definitions, schedule and probe information (any information that is required to
push the agent). This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Config command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Config from the Function drop-down.
3. Click Save Step to save this step and close the window.
580
Resend Drive Info
Instructs the agent to update current drive information: drive ID and letter, drive size, total fragmentation percentage, file system, drive model, volume size and if the drive is a solid-state drive.
The solidstate information may not be 100% accurate due to the lack of industry standards. This
information is used to update the database and the Drives tab of the Computer Management
screen. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Drive Info command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Drive Info from the Function drop-down.
3. Click Save Step to save this step and close the window.
582
Resend Error Logs
Instructs the agent to send the Remote Monitors Error logs from LTErrors.txt and updates data in
the errorlogs table in the LabTech database. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Error Logs command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Error Logs from the Function drop-down.
3. Click Save Step to save this step and close the window.
Resend Event Logs
Instructs the agent to send log information about: Windows updates, Application, System, Security,
Event Logs and any additional event log channels you have subscribed to on Vista or higher
machines. This information is used to update the database and the Log tab of the Computer Management screen. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Event Logs command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Event Logs from the Function drop-down.
3. Click Save Step to save this step and close the window.
584
Resend Everything
Sends the Event Logs, Hardware, Patches, Printers, Processes, Services, Startup, Network
Inventory, System Info, Disks and Software commands to instruct the agent to perform a comprehensive inventory of the target computer. This information is used to update the database. Additionally, the Updates Config command is sent instructing the agent to download the most current
agent template, virus definitions, startup definitions, schedule and probe information (any information that is required to push the agent). The commands are sent separately to the agent and the
script will continue after all tasks are complete. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Everything command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Everything from the Function drop-down.
3. Click Save Step to save this step and close the window.
586
Resend Hardware
Instructs the agent to update the agents hardware information: processors, memory, open ports,
network cards and chassis and BIOS information. This information is used to update the database
and the Hardware and Devices tabs of the Computer Management screen. This function runs
on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Hardware command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Hardware from the Function drop-down.
3. Click Save Step to save this step and close the window.
588
Resend Network Information
Instructs the agent to send information on: open ports, NIC cards, DNS, shared drives, port usage
and files in the TFTP directory (only if the probe is installed). This information is used to update the
database and the Network tab in the Computer Management screen. This function runs on the
agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Network Information command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Network Information from the Function drop-down.
3. Click Save Step to save this step and close the window.
590
Resend Patch Information
Instructs the agent to update the agents Windows Update information. patch category, patch
severity, if the patch is installed, if the patch was pushed to the machine, if the patch was approved
and patch title. This information is used to update the database, the Patching tab of the Computer
Management screen and the Patch Manager. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Patch Information command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Patch Information from the Function drop-down.
3. Click Save Step to save this step and close the window.
592
Resend Printers
Instructs the agent to update current printer information: installed printers, printer names, port
names, resolution and paper types. This information is used to update the database and the Printers tab in the Computer Management screen.This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Printers command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Printers from the Function drop-down.
3. Click Save Step to save this step and close the window.
594
Resend Process List
Instructs the agent to update information on current processes: CPU usage, name of process, process ID, scheduled tasks, memory usage, priority, creation date, number of computers with that
process and Information on the process. This information is used to update the database and the
Processes tab in the Computer Management screen. This function runs on the agent.
NOTE: If the process filter is enabled then the agent machine will not update the process.
Parameters
o
None
Examples
Example #1: Sends a Resend Process List command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Process List from the Function drop-down.
3. Click Save Step to save this step and close the window.
596
Resend Service List
Instructs the agent to update information on current services: names, descriptions, status, startup,
service type, service account and file path. This information is used to update the database and the
Services tab in the Computer Management screen. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Service List command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Service List from the Function drop-down.
3. Click Save Step to save this step and close the window.
Resend Software
Instructs the agent to update current software information: name, install location, installed date, initial size, version and app listing (whether application has been whitelisted or blacklisted). This
information is used to update the database and the Software tab of the Computer Management
screen. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend Software command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend Software from the Function drop-down.
3. Click Save Step to save this step and close the window.
598
Resend System Information
Instructs the agent to update current system information: if ShadowProtect is installed, results of
virus scanner check, last time Windows Update file (windowsupdate.log) was updated, computer
uptime, power status, count of files in the temp directory, current power settings, Windows score
setting (for Windows Vista and higher: CPU score, D3D score, disk score, graphics score, memory
score), trackers, hardware information and time zone. This information is used to update the database and the Welcome, Info, LTBackup, and Devices tabs of the Computer Management
screen. This function runs on the agent.
Parameters
o
None
Examples
Example #1: Sends a Resend System Information command.
Parameters:
o
None
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Resend System Information from the Function drop-down.
3. Click Save Step to save this step and close the window.
600
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
602
CHAPTER 15
Script Functions
This chapter provides parameter information, as well as examples for the various Script functions
available within LabTech.
Script Call
603
Script Exit with Error
605
Script for Each
606
Script for Each SQL
608
Script Goto
610
Script Log Message
614
Script Math
618
Script Note
649
Script RegEx
652
Script Return
653
Script Run
655
Script Sleep
658
Script Call
Jumps to a label in the script and performs the steps after the label. Using the 'Script
Return' will then jump back to the step directly following the 'Script Call' function. This
function runs on the server.
Parameters
o
Label: The label to which you want to jump to in the script.
Examples
Example #1: Performs a script call to ':ScriptCallDestination' and returns.
Parameters:
o
Label: :ScriptCallDestination
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section,
select Add to open the Edit Script Step window.
2. Select Script Call from the Function drop-down.
3. Enter :ScriptCallDestination in the Label field.
4. Click Save Step to save this step and close the window.
5. Right-click the line after the steps you jumped to and select Add to open the Edit Script
Step window.
6. Select Script Return from the Function drop-down.
7. Click Save Step to save this step and close the window.
604
Script Exit with Error
Exits the script and sets the script result state to a failure status in the logs. This function runs on the
server.
Parameters
o
None
Examples
Example #1: Sets script status to failure on exit.
Parameters:
o
None
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Exit with Error from the Function drop-down.
3. Click Save Step to save this step and close the window.
Script for Each
Runs a script for each group of variables in a comma separated list of values. The number of
groups and therefore the number of times the script is executed is equal to the number of values
divided by the number of variables in the comma separated lists. Values are assigned to variables
based on the order in the comma separated lists. This function's run location is dependent on the
script chosen (agent or server).
Parameters
o
Script to Run: Select the script to run from the drop-down. The list of scripts is populated
from the database.
List:The comma separated list of values (the number of values must be evenly divisible by
the number of variables).
Variable:The comma separated list of variables used to pass the values obtained from the
list to the script.
Examples
Example #1: Returns the computer ID, computer name and operating system values defined in a
comma separated list.
Parameters:
o
Script to Run: Actions\Set as Master
List:1,Server,Windows 2012,2,Desktop,Windows 8
Variable:Computer_ID,Name,OS
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script for Each from the Function drop-down.
3. Select Actions\Set As Master from the Script to Run drop-down.
4. Enter 1,Server,Windows 2012,2,Desktop,Windows 8 into the List field.
5. Enter Computer_ID,Name,OS into the Variable field.
6. Click Save Step to save this step and close the window.
606
Script for Each SQL
Performs a SQL query and runs a script for each row returned. The values from the returned
columns are assigned to internal variables with 'sql' prepended to the column name. For example,
the value in the 'Query' column is assigned to the variable %sqlQuery%. This function's run location
is dependent on the script chosen (agent or server).
Parameters
o
SQL: The SQLquery to execute
Script to Run: Select the script to run from the drop-down. The list of scripts is populated
from the database.
ODBC Connection: Leave blank to use the LabTech database
Examples
Example #1: Returns the computer ID, computer name and operating system of the computers at
a given location, retrieved from the LabTech database
Parameters:
o
SQL: SELECT `ComputerID`,`Name`,`OS`,'1' AS Query FROM `LabTech`.`computers`
WHERE `ClientID` = %clientid% AND `LocationID` = %locationid% ;
Script to Run: LTSG Report Computers and Operating Systems
ODBC Connection:
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script for Each SQL from the Function drop-down.
3. Enter SELECT `ComputerID`,`Name`,`OS`,'1' AS Query FROM `LabTech`.`computers` WHERE `ClientID` = %clientid% AND `LocationID` = %locationid% ;
into the SQL field.
4. Select LTSG Report Computers and Operating Systems from the Script to Run dropdown.
5. Leave the ODBCConnection field blank.
6. Click Save Step to save this step and close the window.
608
Script Goto
Jumps to a label (Script Note function with a colon as the first character) or skips the specified number of steps either forward or back. It becomes the Script Exit function if Steps to Skip is blank or
zero. The number of steps is not updated if intervening steps are added. This function runs on the
server.
Parameters
o
Steps to Skip: Label to jump to or the number of steps to skip. To exit script with a success
status, enter 0 or leave entry blank.
Examples
Example #1: Example of how a logic error can result from using a number in the Steps to Skip
parameter.
Parameters:
o
Steps to Skip: 1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Goto from the Function drop-down.
3. Enter 1 into the Steps to Skip field.
4. Click Save Step to save this step and close the window.
610
Example #2: Jumps to a specified label
Parameters:
o
Steps to Skip: :BestPracticeIsToUseLabels
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Goto from the Function drop-down.
3. Enter :BestPracesIsToUseLabels into the Steps to Skip field.
4. Click Save Step to save this step and close the window.
Example #3: Exits script with a status of success
Parameters:
o
Steps to Skip: :0
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Goto from the Function drop-down.
3. Enter 0 into the Steps to Skip field.
4. Click Save Step to save this step and close the window.
612
Script Log Message
Writes an informational entry to the script log. This function runs on the server.
Parameters
o
Message:Message to write to the script log
Examples
Example #1: Sample log message
Parameters:
o
Message:This message will be added to the script log.
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Log from the Function drop-down.
3. Enter This message will be added to the script log. into the Message field.
4. Click Save Step to save this step and close the window.
614
Example #2: Display LabTech User replacements (variables) in the script log
Parameters:
o
Message:Use @= in place of @ to log variable names. e.g., @=computerid@= is @computerid@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Log from the Function drop-down.
3. Enter Use @= in place of @ to log variable names. e.g., @=computerid@= is @computerid@. into the Message field.
4. Click Save Step to save this step and close the window.
Example #3: Display LabTech System replacements (Variables) in the script log
Parameters:
o
Message:Use %= in place of % to log variable names. e.g., %=computerid%= is %computerid%
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Log from the Function drop-down.
3. Enter Use %= in place of % to log variable names. e.g., %=computerid%= is %computerid%. into the Message field.
4. Click Save Step to save this step and close the window.
616
Script Math
Performs basic math on the values entered in the Values parameters and stores the result in
%MATHResult% and the named variable. This function runs on the server.
Parameters
o
Value: First numeric value to use. A variable can be entered with or without the @.
Operator: Select the operator from the drop-down. Available options are: +,1,*,\, div, mod,
pow, abs, max, min
Value: Second numeric value to use. A variable can be entered with or without the @ (abs
does not need a second value).
Variable:Enter the variable name to store the result in, with or without the @.
Examples
Example #1: Example of the addition operator (+). Returns the sum of the two values.
Example #1A:Addition of two constants
Parameters:
o
Value: 7
Operator: +
Value: 5
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select + from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
618
Example #1B:Addition of two variables
Parameters:
o
Value:@Input1@
Operator: +
Value: @Input2@
Variable:Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select + from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #1C:Unary addition. This example assumes you have created an Input3 variable with the
parameter of 1 using the Variable Set function.
o
Value:@Input3@
Operator: +
Value: 1
Variable:Input3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input3@ into the Value field.
620
4. Select + from the Operator drop-down.
5. Enter 1 into the Value field.
6. Enter Input3 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #2: Example of the subtraction operator (-). Returns the difference between the two values. This function assumes you have created Input1 and Input2 variables using the Variable Set
function.
Example #2A: Subtraction of two constants
Parameters:
o
Value: 7
Operator: -
Value: 5
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select - from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #2B: Subtraction of two variables
Parameters:
o
Value: @Input1@
Operator: -
Value: @Input2@
Variable:Output2
622
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select - from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #2C: Unary subtraction. This function example assumes you have created an Input3 variable with a parameter of 2 using the Variable Set function.
Parameters:
o
Value: @Input3@
Operator: -
Value: 1
Variable:Input3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input3@ into the Value field.
4. Select - from the Operator drop-down.
5. Enter 1 into the Value field.
6. Enter Input3 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #3: Example of the multiplication operator (*). Returns the product of the two values.
Example #3A: Multiplication of two constants
624
Parameters:
o
Value: 7
Operator: *
Value: 5
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select * from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #3B: Multiplication of two variables
Parameters:
o
Value: @Input1@
Operator: *
Value: @Input2@
Variable: Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select * from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
626
Example #3C: Unary multiplication.This function example assumes you have created an Input3
variable with a parameter of 5 using the Variable Set function.
Parameters:
o
Value: @Input3@
Operator: *
Value: 2
Variable: Input3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input3@ into the Value field.
4. Select * from the Operator drop-down.
5. Enter 2 into the Value field.
6. Enter Input3 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #4: Example of the division operator (\). Returns a decimal value if first value is not a multiple of the second value.
Example #4A: Division of two constants
Parameters:
o
Value: 7
Operator: \
Value: 5
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
628
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select \ from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #4B: Division of two variables
Parameters:
o
Value: @Input1@
Operator: \
Value: @Input2@
Variable: Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select / from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #4C: Unary division.This function example assumes you have created an Input3 variable
with a parameter of 7 using the Variable Set function.
Parameters:
o
Value: @Input3@
Operator: \
630
Value: 2
Variable: Input3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input3@ into the Value field.
4. Select \ from the Operator drop-down.
5. Enter 2 into the Value field.
6. Enter Input3 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #5: Example of the integer division operator (div). The quotient is rounded down to the
nearest whole number.
Example #5A: Integer division of two constants
Parameters:
o
Value: 7
Operator: div
Value: 5
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select div from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
632
Example #5B: Integer division of two variables
Parameters:
o
Value: @Input1@
Operator: div
Value: @Input2@
Variable: Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select div from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #5C: Unary integer division.This function example assumes you have created an Input3
variable with a parameter of 7 using the Variable Set function.
Parameters:
o
Value: @Input3@
Operator: div
Value: 2
Variable: Input3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input3@ into the Value field.
4. Select div from the Operator drop-down.
5. Enter 2 into the Value field.
634
6. Enter Input3 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #6: Examples of the modulus division operator (mod). Returns the remainder of the
integer division of the first value divided by the second value
Example #6A: Module operation using two constants
Parameters:
o
Value: 7
Operator: mod
Value: 5
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select mod from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #6B: Module operation using two variables
Parameters:
o
Value: @Input1@
Operator: mod
Value: @Input2@
Variable: Output2
Using the function example in a new or existing script :
636
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select mod from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #7: Example of the exponential operator (pow). Raises the first value to the power
defined in the second value.
Example #7A: Power operation using two constants
Parameters:
o
Value: 7
Operator: pow
Value: 5
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select pow from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #7B: Power operation using two variables
Parameters:
638
Value: @Input1@
Operator: pow
Value: @Input2@
Variable: Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select pow from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #7C: Unary power operation.This function example assumes you have created an Input3
variable with a parameter of 2 using the Variable Set function.
Parameters:
o
Value: @Input3@
Operator: pow
Value: 2
Variable: Input3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input3@ into the Value field.
4. Select pow from the Operator drop-down.
5. Enter 2 into the Value field.
6. Enter Input3 into the Variable field.
7. Click Save Step to save this step and close the window.
640
Example #8: Example of the absolute value operator (abs). Returns the absolute value of the first
value.
Example #8A: Absolute value of a constant
Parameters:
o
Value: -8
Operator: abs
Value:
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter -8 into the Value field.
4. Select abs from the Operator drop-down.
5. Leave the Value field blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #8B: Absolute value of a variable. This function example assumes that you have crated
an Input1 variable with a parameter of -9 using the Variable Set function.
Parameters:
o
Value: @Input1@
Operator: abs
Value:
Variable: Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
642
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select abs from the Operator drop-down.
5. Leave the Value field blank.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #9: Example of the maximum operator (max). Compares the two values and returns the
maximum value.
Example #9A: Maximum value of two constants
Parameters:
o
Value: 7
Operator: max
Value: 5
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select max from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #9B: Maximum value of two variables
Parameters:
o
Value: @Input1@
Operator: max
644
Value: @Input2@
Variable: Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select max from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
Example #10: Example of the minimum operator (min). Compares the two values and returns the
minimum value.
Example #10A: Minimum value of two constants
Parameters:
o
Value: 7
Operator: min
Value: 5
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter 7 into the Value field.
4. Select min from the Operator drop-down.
5. Enter 5 into the Value field.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
646
Example #10B: Minimum value of two variables
Parameters:
o
Value: @Input1@
Operator: min
Value: @Input2@
Variable: Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Math from the Function drop-down.
3. Enter @Input1@ into the Value field.
4. Select min from the Operator drop-down.
5. Enter @Input2@ into the Value field.
6. Enter Output2 into the Variable field.
7. Click Save Step to save this step and close the window.
648
Script Note
Adds a remark to the script and will not be executed. This function runs on the server.
Parameters
o
Remark: Remark to be added to script. Use a colon as the first character to specify a label.
Examples
Example #1: Example of a script comment
Parameters:
o
Remark:The Script Note function can be used to document your script with explanatory comments. Placing a colon as the first character of the Remark parameter creates a label that
can serve as a destination for 'Goto' and 'If' functions.
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Note from the Function drop-down.
3. Enter The Script Note function can be used to document your script with explanatory comments. Placing a colon as the first character of the Remark parameter
creates a label that can serve as a destination for 'Goto' and 'If' functions. into the
Remark field.
4. Click Save Step to save this step and close the window.
Example #2: Example of a label that can be used as the destination for a jump function (e.g.,
Script Goto)
Parameters:
o
Remark::ItIsBestPracticeToUseLabels
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Note from the Function drop-down.
3. Enter :ItIsBestPracticeToUseLabels into the Remark field.
4. Click Save Step to save this step and close the window.
650
Script RegEx
Performs regular expression parsing from a string in the Value parameter and stores the result in
%RegEXResult% and the named variable. Use VBScript/VB.net syntax.. This function runs on the
server.
Parameters
o
Value: The value to test
Pattern: The expression to use. If groups are defined, the first group is returned.
Variable: Enter the variable name to store the result in, with or without the @.
Examples
Example #1: Parses a string to return the controller associated with a given PNP ID. This function
example assumes that you have created the following variables with the Variable Set function:
Input1 variable:
Parameter: PCI\\VEN_1028&DEV_0079&SUBSYS_1f151028
Input2 variable:
Parameter:PCI\VEN_1028&DEV_0073&SUBSYS_1f541028,,PERC H310
Reserved,,,
Parameter:PCI\VEN_1028&DEV_0079&SUBSYS_1f151028,,PERC H800
Adapter,,,
Parameter:PCI\VEN_1028&DEV_0079&SUBSYS_1f161028,,PERC H700
Adapter,,,
Parameters:
o
Value: @Input2@
Pattern:@Input1@,,([\w ]+),,,
Variable: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script RegEx from the Function drop-down.
3. Enter @Input2@ into the Value field.
652
4. Enter @Input1@,,([\w ]+),,, into the Pattern field.
5. Enter Output1 into the Variable field.
6. Click Save Step to save this step and close the window.
Script Return
Jumps to the step immediately following the last 'Script Call' function executed. This function runs
on the server.
Parameters
o
None
Examples
Example #1: Performs a script call to ':ScriptCallDest'and returns.
Parameters:
o
None
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Call from the Function drop-down.
3. Enter :ScriptCallDest in the Label field.
4. Click Save Step to save this step and close the window.
5. Right-click the line after the steps you jumped to and select Add to open the Edit Script
Step window.
6. Select Script Return from the Function drop-down.
7. Click Save Step to save this step and close the window.
654
Script Run
Starts a new script and all variables are passed to the new script. If the script fails, then step will fail.
This function's run location depends on the script chosen (agent or server).
Parameters
o
Script ID: Select the script from the drop-down. The list of scripts are populated from the
database.
Delay: Leave blank or enter 0 to run script as a procedure; otherwise, script will be scheduled to run the number of minutes entered.
Examples
Example #1: Launches 'Get Product Keys' from a script.
Parameters:
o
Script ID: _System Automation\Product Keys\Get Product Keys
Delay:
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _System Automation\Product Keys\Get Product Keys from the Script ID dropdown.
4. Leave blank, or enter 0 into the Delay field.
5. Click Save Step to save this step and close the window.
Example #2: Schedules 'Get Product Keys' to run in 1 hour.
Parameters:
o
Script ID: _System Automation\Product Keys\Get Product Keys
Delay: 60
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Run from the Function drop-down.
3. Select _System Automation\Product Keys\Get Product Keys from the Script ID dropdown.
4. Enter 60 into the Delay field.
5. Click Save Step to save this step and close the window.
656
Script Sleep
Pauses the script and waits a number of seconds. This function runs on the server.
Parameters
o
Seconds: Number of seconds to wait
Examples
Example #1: Pause a script for one minute
Parameters:
o
Seconds: 60
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script Sleep from the Function drop-down.
3. Enter 60 into the Seconds field.
4. Click Save Step to save this step and close the window.
658
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
660
CHAPTER 16
Script String Functions
This chapter provides parameter information, as well as examples for the various Script String
functions available within LabTech.
Decrypt Operation
662
Decrypt Version Two Operation
665
Encrypt Operation
668
Encrypt Version Two Operation
671
Find String Operation
674
HTML Decode Operation
676
HTML Encode Operation
678
Insert Operation
680
LabTech Pipe Decode
682
LabTech Pipe Encode
684
Last Find String Operation
686
Left Operation
688
Lower Case Operation
693
Middle Operation
696
MySQL Encode Operation
701
Replace Operation
703
Reverse Operation
706
Right Operation
708
Split Operation
713
Trim Spaces Operation
716
Upper Case Operation
718
URL Decode Operation
721
URL Encode Operation
723
Decrypt Operation
Decrypts strings that have been encoded by the 'Encrypt' operation. This function runs on the
server.
Parameters
o
Operation: Decrypt
Original String:String or replacement variable containing the input string.
Length:Encryption key if used for encryption
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a decrypted string created without an encryption key.
Parameters:
o
Operation: Decrypt
Original String: gca8q6Ben1bNRXeAnhCEOQ==
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Decrypt from the Operation drop-down.
4. Enter gca8q6Ben1bNRXeAnhCEOQ== into the Original String field.
5. Leave the Length field blank.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
662
Example #2: Returns a decrypted string created with an encryption key.
Parameters:
o
Operation: Decrypt
Original String: gca8q6Ben1bNRXeAnhCEOQ==
Length: abcd1234
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Decrypt from the Operation drop-down.
4. Enter gca8q6Ben1bNRXeAnhCEOQ== into the Original String field.
5. Enter abcd1234 into the Length field.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
664
Decrypt Version Two Operation
Decrypts strings that have been encoded by the 'Encrypt Version Two' operation. This function
runs on the server.
Parameters
o
Operation: Decrypt Version Two
Original String:String or replacement variable containing the input string.
Length:Salt value for encryption process (8 character alpha/numeric constant. A random
value will be generated if a salt value is not specified).
Start Position: Passphrase for used in encryption process (Leave blank if passphrase was
left blank during encryption).
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a decrypted string without a passphrase.
Parameters:
o
Operation: Decrypt Version Two
Original String: tPfi9fTKtbA0CZ+gKZPKeNGjNbjl1UuU
Length: abcd1234
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Decrypt Version Two from the Operation drop-down.
4. Enter tPfi9fTKtbA0CZ+gKZPKeNGjNbjl1UuU into the Original String field.
5. Enter abcd1234 into the Length field.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
Example #2: Returns a decrypted string with a passphrase.
Parameters:
o
Operation: Decrypt Version Two
Original String: tPfi9fTKtbA0CZ+gKZPKeNGjNbjl1UuU
Length: abcd1234
Start Position:Prepare To Be Automated
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Decrypt Version Two from the Operation drop-down.
666
4. Enter tPfi9fTKtbA0CZ+gKZPKeNGjNbjl1UuU into the Original String field.
5. Enter abcd1234 into the Length field.
6. Enter Prepare To Be Automated into the Start Position field.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
Encrypt Operation
Encrypts the input string. This function runs on the server.
Parameters
o
Operation: Encrypt
Original String:String or replacement variable containing the input string.
Length:Encryption key (optional)
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns an encrypted string created without an encryption key.
Parameters:
o
Operation: Encrypt
Original String: One,Two,Three
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Encrypt from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Leave the Length field blank.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
668
Example #2: Returns an encrypted string created with an encryption key.
Parameters:
o
Operation: Encrypt
Original String: One,Two,Three
Length: abcd1234
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Encrypt from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter abcd1234 into the Length field.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
670
Encrypt Version Two Operation
Encrypts the input string. This function runs on the server.
Parameters
o
Operation: Encrypt Version Two
Original String:String or replacement variable containing the input string.
Length:Salt value for encryption process (8 character alpha/numeric constant. A random
value will be generated if a salt value is not specified).
Start Position: Passphrase for encryption process (a default passphrase will be used if a
string is not entered).
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns an encrypted string without a passphrase.
Parameters:
o
Operation: Encrypt Version Two
Original String: One,Two,Three
Length: abcd1234
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Encrypt Version Two from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter abcd1234 into the Length field.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
Example #2: Returns an encrypted string with a passphrase.
Parameters:
o
Operation: Encrypt Version Two
Original String: One,Two,Three
Length: abcd1234
Start Position:Prepare To Be Automated
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
672
3. Select Encrypt Version Two from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter abcd1234 into the Length field.
6. Enter Prepare To Be Automated into the Start Position field..
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
Find String Operation
Returns the offset of the first instance of the substring in the original string (the offset is zero (0)
based, a minus one (-1) is returned if the string is not found). This function runs on the server.
Parameters
o
Operation:Find String
Original String:String or replacement variable containing the input string.
Length:Substring or replacement variable
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns the number of characters before the first instance of the specified substring
(i.e., 14).
Parameters:
o
Operation: Find String
Original String: Automate with LabTech Scripting. Manage with LabTech Scripting.
Length: LabTech
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Find String from the Operation drop-down.
4. Enter Automate with LabTech Scripting. Manage with LabTech Scripting. into the Original String field.
5. Enter LabTech into the Length field.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
674
HTML Decode Operation
Decodes strings that have been encoded by the 'HTML Encode' operation. This function runs on
the server.
Parameters
o
Operation:HTMLDecode
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a decoded HTML string. This function assumes you have created a Input1
variable with the string to be decoded (e.g., <!DOCTYPE html><html><body><h1>Heading</h1><p>Paragraph
</p></body></html>) as the parameter using the Variable Set function.
Parameters:
o
Operation: HTMLDecode
Original String: @Input1@
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select HTML Decode from the Operation drop-down.
4. Enter @Input1@ into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
676
HTML Encode Operation
Encodes characters on an HTML page that cannot be transmitted over a network. This function
runs on the server.
Parameters
o
Operation:HTMLEncode
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns an encoded HTML string. This function assumes you have created a Input1
variable with a parameter of what you want to encode (e.g., <!DOCTYPE html><html><body><h1>Heading</h1><p>Paragraph </p></body></html>) using the Variable Set
function.
Parameters:
o
Operation: HTMLEncode
Original String: @Input1@
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select HTML Encode from the Operation drop-down.
4. Enter @Input1@ into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
678
Insert Operation
Inserts substring into input string at specified position. This function runs on the server.
Parameters
o
Operation:Insert
Original String:String or replacement variable containing the input string.
Length:Substring or replacement variable.
Start Position: Integer offset to the position where the substring will be inserted. The offset
is zero (0) based and is the number of characters before the first character of the inserted
substring. It can be any integer from zero (0) to the length of the input string.
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a string with the substring 'three,' inserted after the fourth character in the original string
Parameters:
o
Operation: Insert
Original String: Two,Four,Six
Length: Three,
Start Position:4
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Insert from the Operation drop-down.
4. Enter Two,Four,Six into the Original String field.
5. Enter Three, into the Length field.
6. Enter 4 into the Start Position field.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
680
LabTech Pipe Decode
Decodes strings that have been encoded by the 'LabTech Pipe Encode' operation. This function
runs on the server.
Parameters
o
Operation: LabTech Pipe Decode
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a string with a decoded LabTech Pipe.
Parameters:
o
Operation: LabTech Pipe Decode
Original String: One%7CTwo%7CThree
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select LabTech Pipe Decode from the Operation drop-down.
4. Enter One%7CTwo%7CThree into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
682
LabTech Pipe Encode
Encodes the pipe character (|) to allow the character to be used for purposes other than to split
name value pairs. This function runs on the server.
Parameters
o
Operation: LabTech Pipe Encode
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a string with an encoded LabTech Pipe. This function example assumes you
have created an Input1 variable with a parameter of 'One|Two|Three'.
Parameters:
o
Operation: LabTech Pipe Encode
Original String: @Input1@
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select LabTech Pipe Encode from the Operation drop-down.
4. Enter @Input1@ into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
684
Last Find String Operation
Returns the offset of the last instance of the substring in the original string (the offset is zero (0)
based, a minus one (-1) is returned if the string is not found). This function runs on the server.
Parameters
o
Operation:Last Find String
Original String:String or replacement variable containing the input string.
Length:Substring or replacement variable
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns the number of characters before the last instance of the specified substring
(i.e., 45).
Parameters:
o
Operation: Last Find String
Original String: Automate with LabTech Scripting. Manage with LabTech Scripting.
Length: LabTech
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Last Find String from the Operation drop-down.
4. Enter Automate with LabTech Scripting. Manage with LabTech Scripting. into the Original String field.
5. Enter LabTech into the Length field.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
686
Left Operation
Returns the substring of specified length from original string starting with the leftmost character.This function runs on the server.
Parameters
o
Operation:Left
Original String:String or replacement variable containing the input string.
Length:Number of characters in substring
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns first 3 characters starting from the left (i.e., One)
Parameters:
o
Operation:Left
Original String:One,Two,Three
Length: 3
Start Position:0
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Left from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter 3 into the Length field.
6. Leave the Start Position field blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
688
Example #2: Returns first 7 characters starting from the left using replacement variables (i.e.,
One,Two). This function example assumes that you have created the following variables using the
Variable Set function:
Input variable:
Parameter: One,Two,Three
Count variable:
Parameter: 7
Parameters:
o
Operation:Left
Original String:@Input@
Length:@Count@
Start Position:
Variable:Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Left from the Operation drop-down.
4. Enter @Input@ into the Original String field.
5. Enter @Count@ into the Length field.
6. Leave the Start Position field blank.
7. Enter Output2 into the Variable field.
8. Click Save Step to save this step and close the window.
690
Example #3: Returns entire string if 'Length' value exceeds length of string (i.e., One,Two,Three).
Parameters:
o
Operation:Left
Original String:One,Two,Three
Length:15
Start Position:
Variable:Output3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Left from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter 15 into the Length field.
6. Leave the Start Position field blank.
7. Enter Output3 into the Variable field.
8. Click Save Step to save this step and close the window.
692
Lower Case Operation
Converts a substring of specified length to lower case characters.This function runs on the server.
Parameters
o
Operation:Lower Case
Original String:String or replacement variable containing the input string.
Length:Number of characters converted to lower case starting from the leftmost character.
It can be any integer from zero (0) to the length of string. Zero will output the entire string in
upper case
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a string with the first 5 characters converted to lower case (i.e., lowerUPPER)
Parameters:
o
Operation:Lower Case
Original String:LOWERUPPER
Length: 5
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Lower Case from the Operation drop-down.
4. Enter LOWERUPPER into the Original String field.
5. Enter 5 into the Length field.
6. Enter 0 into the Start Position field..
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
Example #2: The entire string is converted to lower case if Length value is equal to the length of
the string (i.e., lowerupper). Note: The operation will fail if the Length value is greater than the
length of the string.
Parameters:
o
Operation:Lower Case
Original String:LOWERUPPER
Length:10
Start Position:
Variable:Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
694
2. Select Script String Functions from the Function drop-down.
3. Select Lower Case from the Operation drop-down.
4. Enter LOWERUPPER into the Original String field.
5. Enter 10 into the Length field.
6. Enter 0 into the Start Position field..
7. Enter Output2 into the Variable field.
8. Click Save Step to save this step and close the window.
Middle Operation
Returns the substring of specified length from the middle of the original string.This function runs on
the server.
Parameters
o
Operation:Middle
Original String:String or replacement variable containing the input string.
Length:Length of substring
Start Position: Position of first character of the substring. (The first position of the original
string has a value of 1.)
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns 3 characters starting with the fifth character (i.e., Two)
Parameters:
o
Operation:Middle
Original String:One,Two,Three
Length: 3
Start Position:5
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Middle from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter 3 into the Length field.
6. Enter 5 into the Start Position field..
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
696
Example #2: Returns 9 characters starting with the fifth character using replacement variables.
(i.e., Two,Three). This function example assumes that you have created the following variables
using the Variable Set function:
Input variable:
Parameter: One,Two,Three
Start variable:
Parameter: 5
Count variable:
Parameter: 9
Parameters:
o
Operation:Middle
Original String:@Input@
Length:@Count@
Start Position:@Start@
Variable:Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Middle from the Operation drop-down.
4. Enter @Input@ into the Original String field.
5. Enter @Count@ into the Length field.
6. Enter @Start@ into the Start Position field.
7. Enter Output2 into the Variable field.
8. Click Save Step to save this step and close the window.
698
Example #3: Returns the next 25 characters starting with the fifth character. If the 'Length' value
exceeds the number of characters to the right of the start position then it returns all characters starting with the fifth character (i.e.,Two,Three, Four).
Parameters:
o
Operation:Middle
Original String:Two,Three,Four
Length:25
Start Position: 5
Variable:Output3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Middle from the Operation drop-down.
4. Enter Two,Three,Fourinto the Original String field.
5. Enter 25 into the Length field.
6. Enter 5 into the Start Position field.
7. Enter Output3 into the Variable field.
8. Click Save Step to save this step and close the window.
700
MySQL Encode Operation
Encodes special characters in a SQL script to allow the script to be inserted into a database table.
This function runs on the server.
Parameters
o
Operation: MYSQLEncode
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns an encoded MySQL string. This function assumes you have created a
Input1 variable with a parameter of what you want to encode (e.g., INSERT INTO `Database`.`Table` (`Column1`,`Column2`) VALUES ('Special Characters',' " \; ' );) using the Variable
Set function.
Parameters:
o
Operation: MYSQLEncode
Original String: @Input1@
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select MYSQLEncode from the Operation drop-down.
4. Enter @Input1@ into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
702
Replace Operation
Replaces all instances of a substring in the original string. This function runs on the server.
Parameters
o
Operation:Replace
Original String:String or replacement variable containing the input string.
Length: Substring or replacement variable to be inserted.
Start Position: Substring or replacement variable to be replaced.
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a string with the one instance of the substring (i.e., 'Two' replaced with 'Six').
Parameters:
o
Operation:Replace
Original String: One, Two, Three
Length: Six
Start Position: Two
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Replace from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter Six into the Length field.
6. Enter Two into the Start Position field..
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
Example #2: Returns a string with the two instances of the substring (i.e., 'Two' replaced with
'Four').
Parameters:
o
Operation: Replace
Original String: One,Two,Three,Two
Length: Four
Start Position:Two
Variable:Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
704
3. Select Replace from the Operation drop-down.
4. Enter One,Two,Three,Two into the Original String field.
5. Enter Four into the Length field.
6. Enter Two into the Start Position field..
7. Enter Output2 into the Variable field.
8. Click Save Step to save this step and close the window.
Reverse Operation
Reverses the order of the characters in a string. This function runs on the server.
Parameters
o
Operation:Reverse
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a string with the characters in reverse order (i.e., 987654321)
Parameters:
o
Operation:Reverse
Original String:123456789
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Reverse from the Operation drop-down.
4. Enter 123456789 into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
706
Right Operation
Returns the substring of specified length from original string starting with the rightmost character.This function runs on the server.
Parameters
o
Operation:Right
Original String:String or replacement variable containing the input string.
Length:Number of characters in substring
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns first 5 characters starting from the right (i.e., Three)
Parameters:
o
Operation:Right
Original String:One,Two,Three
Length: 5
Start Position:0
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Right from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter 5 into the Length field.
6. Enter 0 into the Start Position field..
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
708
Example #2: Returns first 9 characters starting from the right using replacement variables (i.e.,
two,three). This function example assumes that you have created the following variables using the
Variable Set function:
Input variable:
Parameter: one,two,three
Count variable:
Parameter: 9
Parameters:
o
Operation:Right
Original String:@Input@
Length:@Count@
Start Position:
Variable:Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Right from the Operation drop-down.
4. Enter @Input@ into the Original String field.
5. Enter @Count@ into the Length field.
6. Leave the Start Position blank.
7. Enter Output2 into the Variable field.
8. Click Save Step to save this step and close the window.
710
Example #3: Returns entire string if 'Length' value exceeds length of string (i.e., One,Two,Three)
Parameters:
o
Operation:Right
Original String:One,Two,Three
Length:15
Start Position:
Variable:Output3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Right from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter 15 into the Length field.
6. Leave the Start Position field blank.
7. Enter Output3 into the Variable field.
8. Click Save Step to save this step and close the window.
712
Split Operation
Splits the input string into an array of substrings delimited by the character specified in the Length
field. Returns the substring specified by the value in the Start Position field. This function runs on
the server.
Parameters
o
Operation: Split
Original String:String or replacement variable containing the input string.
Length:Character used to delimit the substrings in the input string.
Start Position: Index of the array element to be returned. The index is zero (0) based.
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns the first element in the array created when the string was split.
Parameters:
o
Operation: Split
Original String: One,Two,Three
Length: ,
Start Position:0
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Split from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter , into the Length field.
6. Enter 0 into the Start Position field..
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
Example #2: Returns the third element in the array using a replacement variable. This function
example assumes that you have created an 'Element' variable with a parameter of 2 using the Variable Set function.
Parameters:
o
Operation: Split
Original String: One,Two,Three
Length: ,
Start Position:@Element@
Variable:Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
714
2. Select Script String Functions from the Function drop-down.
3. Select Split from the Operation drop-down.
4. Enter One,Two,Three into the Original String field.
5. Enter , into the Length field.
6. Enter @Element@ into the Start Position field..
7. Enter Output2 into the Variable field.
8. Click Save Step to save this step and close the window.
Trim Spaces Operation
Removes leading and trailing space characters from a string. This function runs on the server.
Parameters
o
Operation:Trim Spaces
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Demonstrates the trimming of leading and trailing spaces of the value in Input1 (i.e.,
String1).This function example assumes that the following variables have been set using the Variable Set function.
Input 1 variable:
Parameter: xxxxxString1xxxxx (x's indicate spaces, use actual spaces when creating
the variable)
Parameters:
o
Operation: Trim Spaces
Original String: @Input1@
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Trim Spaces from the Operation drop-down.
4. Enter @Input1@ into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
716
7. Click Save Step to save this step and close the window.
Upper Case Operation
Converts a substring of specified length to upper case characters.This function runs on the server.
Parameters
o
Operation:Upper Case
Original String:String or replacement variable containing the input string.
Length:Number of characters converted to upper case starting from the leftmost character.
It can be any integer from zero (0) to the length of string. Zero will output the entire string in
upper case
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns a string with the first 5 characters converted to upper case (i.e.,
UPPERlower)
Parameters:
o
Operation:Upper Case
Original String:upperlower
Length: 5
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Upper Case from the Operation drop-down.
4. Enter upperlower into the Original String field.
5. Enter 5 into the Length field.
6. Leave the Start Position blank.
7. Enter Output1 into the Variable field.
8. Click Save Step to save this step and close the window.
718
Example #2: The entire string is converted to upper case if Length value is equal to the length of
the string (i.e., UPPERLOWER). Note: The operation will fail if the Length value is greater than
the length of the string.
Parameters:
o
Operation:Upper Case
Original String:upperlower
Length:10
Start Position:
Variable:Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select Upper Case from the Operation drop-down.
4. Enter upperlower into the Original String field.
5. Enter 10 into the Length field.
6. Leave the Start Position field blank.
7. Enter Output2 into the Variable field.
8. Click Save Step to save this step and close the window.
720
URL Decode Operation
Decodes strings that have been encoded by the 'URL Encode' operation. This function runs on the
server.
Parameters
o
Operation:URLDecode
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns an decoded URL string. This function assumes you have created a Input1
variable with a parameter of www.somewebsite.com%2Fsome%26thing using the Variable Set
function.
Parameters:
o
Operation: URLDecode
Original String: @Input1@
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select URLDecode from the Operation drop-down.
4. Enter @Input1@ into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
722
URL Encode Operation
Encodes characters that are unacceptable in a URL into a form that is permitted on the Internet.
This function runs on the server.
Parameters
o
Operation:URLEncode
Original String:String or replacement variable containing the input string.
Length:N/A
Start Position: N/A
Variable:Name of variable to store result in (result is also stored in %stringresult%)
Examples
Example #1: Returns an encoded URL string. This function assumes you have created a Input1
variable with a parameter of www.somewebsite.com/something using the Variable Set function.
Parameters:
o
Operation: URLEncode
Original String: @Input1@
Length:
Start Position:
Variable:Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Script String Functions from the Function drop-down.
3. Select URLEncode from the Operation drop-down.
4. Enter @Input1@ into the Original String field.
5. Leave the Length and Start Position fields blank.
6. Enter Output1 into the Variable field.
7. Click Save Step to save this step and close the window.
724
CHAPTER 17
Shell Functions
This chapter provides parameter information, as well as examples for the various Shell functions
available within LabTech.
Execute Script
726
Power Shell Command
729
PowerShell Command as Admin
731
Shell
733
Shell as Admin
735
Shell as User
737
Shell Enhanced
739
Execute Script
Executes a script and stores the script in %invokedscript% and stores the script result in the named
variable. This function runs on the agent.
Parameters
o
Script Type: Select the script type from the drop-down. The available options are PowerShell, VBScript, Batch, Powershell Bypass and Powershell.
Script to Execute: Click the Ellipsis button to open the Script Text Editor to enter the
script.
Script Parameters: Enter any script parameters to send.
Script Credentials: Select the credentials to use from the drop-down. Available options
are:Local Agent, Run as Admin.
Variable:Enter the variable to store the result of output.
Examples
Example #1: Runs a PowerShell script to retrieve MAC addresses for network adapters on the target computer.
Parameters:
o
Script Type: Powershell
Script to Execute:
Script Parameters:
Script Credentials: Run as Admin.
Variable:PowerShellOutput
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
726
open the Edit Script Step window.
2. Select Execute Script from the Function drop-down.
3. Select Powershell from the Script Type drop-down.
4. Enter the following code in the Script to Execute text editor.
5. Leave the Script Parameter field blank.
6. Select Run as Admin from the Script Credentialsfield.
7. Enter PowerShellOutput in the Variable field.
8. Click Save Step to save this step and close the window.
728
Power Shell Command
Executes a PowerShell command using PS.exe to run it and then stores the result in %PowerShellresult%. This function runs on the agent.
Parameters
o
Command: Commands to execute
Examples
Example #1: Run a command in the background to demonstrate that PowerShell is running in the
context of the LabTech agent.
Parameters:
o
Command: whoami | write-output
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Powershell Command from the Function drop-down.
3. Enter whoami | write-output into the Command field.
4. Click Save Step to save this step and close the window.
730
PowerShell Command as Admin
Executes PowerShell command using PS.exe using Admin permissions. The Login to use for
Administrator Access field must be set on the Deployment & Defaults tab for the associated
location. The result is stored in %PowerShellresult%.This function runs on the agent.
Parameters
o
Command: Commands to execute
Examples
Example #1: Runs a command in the background to demonstrate that PowerShell is running in
the context of the Administrator.
Parameters:
o
Command: whoami | write-output
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Powershell Command as Admin from the Function drop-down.
3. Enter whoami | write-output into the Command field.
4. Click Save Step to save this step and close the window.
732
Shell
Executes shell commands in the background, using CMD.exe to run them. The result is returned in
%shellresult%. This function runs on the agent.
Parameters
o
Command: Commands to execute
Examples
Example #1: Runs a command in the background to demonstrate the shell is running in the context of the LabTech agent.
Parameters:
o
Command: whoami
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Shell from the Function drop-down.
3. Enter whoami into the Command field.
4. Click Save Step to save this step and close the window.
734
Shell as Admin
Execute shell commands as the Administrator account defined for the location, using CMD.exe to
run them. The result is returned in %shellresult%. This function runs on the agent.
Parameters
o
Command: Commands to execute.
Examples
Example #1: Runs a command in the background to demonstrate the shell is running in the context of the Administrator.
Parameters:
o
Command: whoami
Using the function example in a new or existing script:
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Shell as Admin from the Function drop-down.
3. Enter whoami into the Command field.
4. Click Save Step to save this step and close the window.
736
Shell as User
Execute shell commands as the specified user, using CMD.exe to run them. The result is returned
in %shellresult%. This function runs on the agent.
Parameters
o
Command: Commands to execute
Username: The username to run this process as
Password: The password associated with this username
Examples
Example #1: Runs a command in the background to demonstrate the shell is running in the context of a user. This function example assumes you have created LTSG_Username and LTSG_
Password variables using the Variable Set function.
Parameters:
o
Command: whoami
Username: @LTSG_UserName@
Password: @LTSG_Password@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Enter whoami into the Command field.
3. Select Shell as User from theFunction drop-down.
4. Enter @LTSG_UserName@ into the Username field.
5. Enter @LTSG_Password@ into the Password field.
6. Click Save Step to save this step and close the window.
738
Shell Enhanced
Executes shell commands in the background, using CMD.exe to run them. This function runs on
the agent.
Parameters
o
Command: Commands to execute
Delimiter: Used to split the variable list and the results, returned by the shell command.
Variable List: List of variables to be set from the resulting shell command.
Examples
Example #1: Runs a command in the background to demonstrate the shell is running in the context of the LabTech agent.
Parameters:
o
Command: whoami
Delimiter:
Variable List: WhoAmI
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Shell Enhanced from the Function drop-down.
3. Enter whoami into the Command field.
4. Leave the Delimiter field blank.
5. Enter WhoAmI into the Variable Listfield.
6. Click Save Step to save this step and close the window.
Example #2: Runs a VBscript in the background to show how to return more than one value from
the script.
Parameters:
o
Command: cscript.exe //nologo %tempdir%\LTSG_ShellEnhancedOutput.vbs
Delimiter: ,
Variable List: Output1,Output2,Output3
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Shell Enhanced from the Function drop-down.
3. Enter cscript.exe //nologo %tempdir%\LTSF_ShellEnhancedOutput.vbs into the
Command field.
4. Enter , into the Delimiterfield.
5. Enter Output1,Output2,Output3 into the Variable Listfield.
6. Click Save Step to save this step and close the window.
740
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
742
CHAPTER 18
Software Functions
This chapter provides parameter information, as well as examples for the various Software
functions available within LabTech.
Email
744
Email Alerts
746
Email Load Attachment
748
Play Sound
750
Plugin Agent Command
752
Plugin Server Function
753
Report Email
754
Report Print
756
Tool Install
758
Email
Sends an email message from the LabTech server. This function runs on the server.
Parameters
o
To: Address to send email to, separate multiple addresses with a semi-colon (;).
Subject:Subject of the email.
Body:Body of message.
File Path:Path of file to attach to email or list of attachment IDs. Leave empty to send email
without an attachment.
Examples
Example #1: Sends an email with an attachment. This function example assumes you have created:
o
LTSG_EmailAddress variable, populating the parameter with a valid email address.
LTSG_EmailAttachmentID variable, set to a file path %tempdir\LTSG_SampleEmailAttachment.txt.
Parameters:
o
To: @LTSG_EmailAddress@
Subject:LTSG_EmailWithAttachment
Body:This is a sample email.
File Path:@LTSG_EmailAttachmentID@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Email from the Function drop-down.
3. Enter @LTSG_EmailAddress@ into the To field.
4. Enter LTSG_EmailWithAttachment into the Subject field.
5. Enter @LTSG_EmailAttachmentID@ into the File Path field.
6. Click Save Step to save this step and close the window.
744
Email Alerts
Send all alerts for the target computer to a specific email address. This function runs on the server.
Parameters
o
Email: Address where the alerts will be sent.
Clear:Choose whether to clear this computers alerts after sending email from drop-down
menu. (Yes, No)
Examples
Example #1: Email alerts for a target computer. This function example assumes you have created
an LTSG_EmailAddress variable, populating the parameter with a valid email address.
Parameters:
o
Email: @LTSG_EmailAddress@
Clear:Yes
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Email Alerts from the Function drop-down.
3. Enter @LTSG_EmailAddress@ into the Email field.
4. Select Yes from the Clear drop-down.
5. Click Save Step to save this step and close the window.
746
Email Load Attachment
Loads an attachment into the database for sending with email, returns %AttachmentID%.This function runs on the agent.
Parameters
o
File Path: Path to the file to load as an attachment
Variable:Variable to save the IDof the attachment to
Examples
Example #1: Loads an email attachment. This function example assumes you have created an
LTSG_EmailAttachmentID variable, set to a file path %tempdir\LTSG_SampleEmailAttachment.txt using the variable set function.
Parameters:
o
File Path: %tempdir%\LTSG_SampleEmailAttachment.txt
Variable:LTSG_EmailAttachmentID
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Email Load Attachment from the Function drop-down.
3. Enter %tempdir%\LTSG_SampleEmailAttachment.txt into the File Path field.
4. Enter LTSG_EmailAttachmentID into the Variable field.
5. Click Save Step to save this step and close the window.
748
Play Sound
Play a sound file on the remote computer.This function runs on the agent.
Parameters
o
Wave File: The full path to the wave file.
Examples
Example #1: Play a wave file.
Parameters:
o
Wave File: %ltsvcdir%\packages\ltsg\soundbite\soundbite.wav
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Play Sound from the Function drop-down.
3. Enter %ltsvcdir%\packages\ltsg\soundbite\soundbite.wav into the Wave File field.
4. Click Save Step to save this step and close the window.
750
Plugin Agent Command
Executes an Agent Plugin Command and returns the results to %=PluginCommandResults%=.
This function runs on the agent. For SDK use only.
752
Plugin Server Function
Executes a Plugin Function and returns the results to %=PluginResults%=. This function runs on
the server. For SDK use only.
Report Email
Email report as a PDF attachment.This function runs on the server.
Parameters
o
Report: Select Report from drop-down menu. (List of users retrieved from database)
Email:Email address to send report to.
Selection: The Crystal Reports selection string to limit the results.
Subject: The subject of the email.
Message: The body of the message as the report will be a PDF attachment.
Examples
Example #1:Email the Hardware Report as a PDF attachment. This function example assumes
you have created:
o
LTSG_EmailAddress variable, populating the parameter with a valid email address.
locationid variable, set to the chosen location to be used for the report email.
clientid variable, set to the specific client.
Parameters:
o
Report: Hardware
Email:@LTSG_EmailAddress@
Selection:{locations.LocationID}=@locationid@ AND{clients.ClientID} = @clientID@ > 0
Subject: Hardware Report - Client @clientid@ at Location @locationid@
Message:Here is the Hardware Report for Client @clientid@ at Location @locationid@ in
PDFform.
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Report Email from the Function drop-down.
3. Select Hardware from the Report drop-down.
4. Enter @LTSG_EmailAddress@ into the Email field.
5. Enter {locations.LocationID}=@locationid@ AND{clients.ClientID} = @clientID@ >
0 into the Selection field.
754
6. Enter Hardware Report - Client @clientid@ at Location @locationid@ into the Subject field.
7. Enter Here is the Hardware Report for Client @clientid@ at Location @locationid@
in PDFform. into the Message field.
8. Click Save Step to save this step and close the window.
Report Print
Prints a specific report on the LabTech server's default printer.This function runs on the server.
Parameters
o
Report: Select report to run from drop-down menu. (List of Reports retrieved from database).
Printer:This is the name of the printer the results will print to. The report will be limited to the
results using the Crystal Reports selection string. Leave this field blank to print to a default
printer
Examples
Example #1: Print the Hardware Report on a local computer to the default printer. This function
example assumes you have created an LTSG_Printer variable, populating the parameter with a
chosen printer.
Parameters:
o
Hardware: Hardware
Printer:@LTSG_Printer@
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Report Print from the Function drop-down.
3. Select Hardware into the Reportdrop-down.
4. Enter @LTSG_Printer@ into the Printer field.
5. Click Save Step to save this step and close the window.
756
Tool Install
Installs or removes a tool or tweak.This function runs on the agent.
Parameters
o
Action: Choose an action from drop-down menu. (Install, Remove)
Tool ID:Select a tool to be installed or removed from drop-down menu. (List of Tools
retrieved from database).
NOTE: Only tools added to the LabTech server will be listed in the drop-down menu. Perform
steps in LabTech documentation at Using Tools and Tweaks to add tools to the server.
758
CHAPTER 19
Ticket Functions
This chapter provides parameter information, as well as examples for the various Ticket functions
available within LabTech.
Ticket Add Time
760
Ticket Assign
762
Ticket Attach File
764
Ticket Combine
766
Ticket Comment
768
Ticket Create
771
Ticket Elevate
773
Ticket Finish
775
Ticket Open
777
Ticket Reading View
779
Ticket Stall
782
Ticket Update
785
Ticket Add Time
Adds time to the ticket as a specified user. This function runs on the server.
Parameters
o
Ticket ID: Ticket to add time to
User ID:Enter a variable name or select the User from the drop-down. The list of users is
retrieved from the database.
Body:The message to add to the body.
Time:Number of minutes to add to the ticket.
Time Category ID:ID number of the time category to add. Time category IDs can be found
in the Dashboard >Configurations>Time Category.
Examples
Example #1: Adds 30 minutes to the ticket under the time category with an ID of 4 (in default installations, this would be Remote Consulting)
Parameters:
o
Ticket ID: %ticketid%
User ID:Admin
Body:Time was added to the ticket
Time:30
Time Category ID: 4
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Add Time from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Select Admin from the User ID drop-down.
5. Enter Time was added to the ticket into the Body field.
6. Enter 30 into the Time field.
7. Enter 4 into the Time Category ID field.
8. Click Save Step to save this step and close the window.
760
Ticket Assign
Assigns a ticket to a specified user. This function runs on the server.
Parameters
o
Ticket ID: Ticket to open
User:Select the User from the drop-down. The list of users is retrieved from the database.
Examples
Example #1: Assigns a ticket to the user 'Admin'
Parameters:
o
Ticket ID: %ticketid%
User:Admin
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Assign from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Select Admin from the User ID drop-down.
5. Click Save Step to save this step and close the window.
762
Ticket Attach File
Attaches a file to an existing ticket . This function runs on the agent. The File Upload function is
used to transfer the file to the LabTech server.
Parameters
o
Ticket ID: Ticket to attach the file to
User ID:User to perform the attach. Enter a variable name or select the User from the dropdown. The list of users is retrieved from the database.
Body:The message to include in the body
File Path:Enter the local path of the file to attach (on the agent computer)
Examples
Example #1: Uploads a file to the server and attaches the file to the specified ticket
File Upload Function
Parameters:
o
File Path: %tempdir%\LTSG_SampleFile.txt
Ticket Attach File Function
Parameters:
o
Ticket ID: %ticketid%
User ID:Admin
Body:Afile was attached to the ticket
File Path:%uploadedfile%
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Attach File from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Select Admin from the User ID drop-down.
5. Enter Afile was attached to the ticket into the Body field.
6. Enter %uploadedfile% into the File Path field.
764
7. Click Save Step to save this step and close the window.
Ticket Combine
Combines the ticket into a master ticket. This function runs on the server.
Parameters
o
Master Ticket: The ticket IDto keep
Combined Ticket:Ticket IDto combine with the master ticket
Examples
Example #1: Combines a newly created ticket into the master ticket. This function example
assumes that you have created an masterticketid variable using the Variable Set function.
Parameters:
o
Master Ticket: @masterticketid@
Combined Ticket:%ticketid%
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Combine from the Function drop-down.
3. Enter @masterticketid@ into the Master Ticket field.
4. Enter %ticketid% into the Combined Ticket field.
5. Click Save Step to save this step and close the window.
766
Ticket Comment
Comments on a ticket as a specific user. This function runs on the server.
Parameters
o
Ticket ID: Ticket to comment on
User ID:Enter a variable name or select the User from the drop-down. The list of users is
retrieved from the database.
Body:The message to add to the body
Respond:Select Yes or No from the drop-down to send an email to the requester.
Examples
Example #1: Adds the comment 'A comment was made on the ticket' to the ticket and does not
send an email to the requester.
Parameters:
o
Ticket ID: %ticketid%
User ID:Admin
Body:A comment was made on the ticket
Respond:No
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Add Time from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Select Admin from the User ID drop-down.
5. Enter A comment was made on the ticket into the Body field.
6. Enter No into the Respond field.
7. Click Save Step to save this step and close the window.
768
Example #2: Adds the comment 'A comment was emailed to the requestor' to the ticket and sends
an email to the originator.
Parameters:
o
Ticket ID: %ticketid%
User ID:Admin
Body:A comment was emailed to the requestor
Respond:Yes
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Add Time from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Select Admin from the User ID drop-down.
5. Enter A comment was emailed to the requestor into the Body field.
6. Enter Yes into the Respond field.
7. Click Save Step to save this step and close the window.
770
Ticket Create
Creates a new support ticket and saves the ticket ID to %ticketid%. This function runs on the
server.
Parameters
o
Client ID: Client IDto link the ticket to
Computer ID:Computer IDto the link the ticket to
Email:Email address of the ticket requester
Subject: Subject of the ticket
Body:The message to include as the body
Examples
Example #1: Creates a new ticket
Parameters:
o
Client ID: %clientid%
Computer ID:%computerid%
Email:[email protected]
Subject: Sample ticket
Body:This is a sample ticket for training
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Add Time from the Function drop-down.
3. Enter %client% into the Client ID field.
4. Enter %computerid% into the Computer ID field.
5. Enter
[email protected] into the Email field.
6. Enter Sample ticket into the Subject field.
7. Enter This is a sample ticket for training into the Body field.
8. Click Save Step to save this step and close the window.
772
Ticket Elevate
Elevates the selected ticket to the next level. There are six levels (0-5) and the default level is 1.
This function runs on the server.
Parameters
o
Ticket ID: Ticket ID to elevate
Examples
Example #1: Elevates the ticket to level 2
Parameters:
o
Ticket ID: %ticketid%
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Elevate from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Click Save Step to save this step and close the window.
774
Ticket Finish
Finishes the ticket as a specific user. This function runs on the server.
Parameters
o
Ticket ID: Ticket to finish
User ID:Enter a variable name or select the User from the drop-down. The list of users is
retrieved from the database.
Body:The message to add to the body
Examples
Example #1: Resolves the ticket as 'Admin' and sends the requestor the resolution information
Parameters:
o
Ticket ID: %masterticketid%
User ID:Admin
Body:The ticket is now closed
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Finish from the Function drop-down.
3. Enter %masterticketid% into the Ticket ID field.
4. Select Admin from the User ID drop-down.
5. Enter The ticket is now closed into the Body field.
6. Click Save Step to save this step and close the window.
776
Ticket Open
Opens a ticket as a specific user. This function runs on the server.
Parameters
o
Ticket ID: Ticket to open
User ID:Enter a variable name or select the User from the drop-down. The list of users is
retrieved from the database.
Body:The message to add to the body
Examples
Example #1: Opens a ticket
Parameters:
o
Ticket ID: %ticketid%
User:Admin
Body:Ticket #%ticketid% was opened.
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Open from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Select Admin from the User ID drop-down.
5. Enter Ticket #%ticketid% was opened. into the Body field.
6. Click Save Step to save this step and close the window.
778
Ticket Reading View
Creates a Ticket Reading View and saves it to %ticketreadingview%. This function runs on the
server.
Parameters
o
Ticket ID: Ticket IDto use
Newest on Top:Select Yes from the drop-down to list the newest items first; otherwise
select No.
HTML:Select Yes from the drop-down to use HTML to display the message; otherwise,
select No.
For Customer:Select Yes to hide internal ticketing information; otherwise, select No.
Examples
Example #1: Creates a Ticket Reading View of the master ticket in HTMLformat with the most
recent actions on top and does not hide internal ticketing information.
Parameters:
o
Ticket ID: @masterticketid@
Newest on Top:Yes
HTML:Yes
For Customer:Yes
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Reading View from the Function drop-down.
3. Enter %masterticketid% into the Ticket ID field.
4. Select Yes from the Newest on Top drop-down.
5. Select Yes from the HTML drop-down.
6. Select Yes from the For Customer drop-down.
7. Click Save Step to save this step and close the window.
Example #2: Creates a Ticket Reading View of the master ticket with the most recent actions on
the bottom and internal ticketing information is hidden.
Parameters:
o
Ticket ID: @masterticketid@
Newest on Top:No
HTML:No
For Customer:No
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Reading View from the Function drop-down.
3. Enter %masterticketid% into the Ticket ID field.
780
4. Select No from the Newest on Top drop-down.
5. Select No from the HTML drop-down.
6. Select No from the For Customer drop-down.
7. Click Save Step to save this step and close the window.
Ticket Stall
Stalls or unstalls the ticket. This function runs on the server.
Parameters
o
Ticket ID: Ticket ID to stall or unstall
Action:Select Stall or Unstall from the drop-down.
Date to Unstall:If stalling ticket, enter the date in YYYY-MM-DD HH:MM:SS format to
unstall the ticket.
Examples
Example #1: Stalls a ticket and unstalls the ticket on 01/01/2015 at midnight.
Parameters:
o
Ticket ID: %ticketid%
Action:Stall
Date to Unstall:2015-01-01 00:00:00
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Stall from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Select Stall from the Action drop-down.
5. Enter 2015-01-01 00:00:00 into the Date to Unstall field.
6. Click Save Step to save this step and close the window.
782
Example #2: Unstalls a ticket
Parameters:
o
Ticket ID: %ticketid%
Action:Unstall
Date to Unstall:
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Stall from the Function drop-down.
3. Enter %ticketid% into the Ticket ID field.
4. Select Unstall from the Action drop-down.
5. Leave Date to Unstall field blank.
6. Click Save Step to save this step and close the window.
784
Ticket Update
Updates the ticket information. This function runs on the server.
Parameters
o
Requestor Email: New requestor email address. Leave blank to keep existing.
Priority:New priority. Leave blank to keep existing.
Subject:New ticket subject. Leave blank to keep existing.
Category ID:New category ID. Leave blank to keep existing.
Ticket ID:Ticket IDto update
Examples
Example #1: Changes the requestor email's address listed on the ticket to [email protected]
Parameters:
o
Priority:
Subject:
Category ID:
Ticket ID:%ticketid%
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Ticket Update from the Function drop-down.
3. Enter
[email protected] into the Requestor Email field.
4. Leave the Priority, Subject and Categoy ID fields blank.
5. Enter %ticketid% into the Ticket ID field.
6. Click Save Step to save this step and close the window.
786
CHAPTER 20
Variable Functions
This chapter provides parameter information, as well as examples for the various Variable
functions available within LabTech.
Variable Check
788
Variable Set: All Local Variables
791
Variable Set: Constant
793
Variable Set: Current ClientID Variable
796
Variable Set: Current ComputerID Variable
798
VariableSet: Current Console Number Variable
800
Variable Set: Current LocationID Variable
802
Variable Set: Expand on Agent Variable
804
Variable Set: File Contents Variable
806
Variable Set: File Date Variable
808
Variable Set: File MD5 Hash Variable
810
Variable Set: File Size Variable
812
Variable Set: File Version Variable
814
Variable Set: Get Virus Scanner Variables
816
Variable Set: Properties Variable
818
Variable Set: Registry Variable
820
Variable Set:Reload Computer Variables
822
Variable Set: Split Name Value Parameter Variables
824
Variable Set: SQL Query Variable
826
Variable Set: Temp Directory Variable
828
Variable Check
Compares a variable to the specified data and skips if the result is true. This function runs on the
server.
Parameters
o
Variable Name:Enter the variable name without the @.
Compare: Logical Operator (use drop-down menu.) (Exists, Not Exists, =, Not =, <, <=, >,
>=, Contains, Not Contains, In, Not In)
To: Value to compare to.
Steps to Skip : Number of steps to skip when the result is true, blank or zero skips to end of
script. The next step can also be defined by a label, a script note function beginning with a
colon.
Examples
Example #1: Determines if a variable exists.
Parameters:
o
Variable Name:Input1
Compare: Exists
To: N/A
Steps to Skip::VariableExists
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter Input1 into the Variable Name field.
4. Select Exists from the Compare drop-down.
5. Leave the To field blank.
6. Enter :VariableExists into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
788
Example #2: Determines if the value assigned to the variable is greater than 50.
Parameters:
o
Variable Name:Inputs
Compare: >
To: 50
Steps to Skip::LargeInput
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Check from the Function drop-down.
3. Enter Inputs into the Variable Name field.
4. Select > from the Compare drop-down.
5. Enter 50 into the To field.
6. Enter :LargeInput into the Steps to Skip field.
7. Click Save Step to save this step and close the window.
790
Variable Set: All Local Variables
Assigns the name and value of all system and user variables to the variable. This function runs on
the server.
Parameters:
o
Set Type: Select All Local Variables from the drop-down.
Parameter: N/A
Variable Name: Variable name without @.
Example:
Assigns all the contents of all local variables to the variable Output1.
Parameters:
o
Set Type:All Local Variables
Parameter: N/A
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select All Local Variables from the Set Type drop-down.
4. Leave the Parameter field blank.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
792
Variable Set: Constant
Assigns data from the registry to the variable. This function runs on the server.
Parameters
o
Set Type:Select Constant from the drop-down.
Parameter: Data to be assigned to variable. Parameter may be literal values or the contents
of a variable.
Variable Name: Enter the variable name without @.
Examples
Example #1: Assigns a string to the variable Output1.
Parameters:
o
Set Type:Constant
Parameter: Thank You for using LabTech Software!!!
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Thank You for using LabTech Software!!! into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
Example #2: Assigns the contents of the variable @Input2@ to the variable Output2.
Parameters:
o
Set Type:Constant
Parameter: Thank You for using LabTech Software!!!
Variable Name: Input2
Set Type: Constant
Parameter: @Input2@
Variable Name: Output2
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
794
2. Select Variable Set from the Function drop-down.
3. Select Constant from the Set Type drop-down.
4. Enter Thank You for using LabTech Software!!! into the Parameter field.
5. Enter Input2 into the Variable Name field.
6. Click Save Step to save this step and close the window.
7. Right-click the next line, select Add to open the Edit Script Step window.
8. Select Variable Set from the Function drop-down.
9. Select Constant from the Set Type drop-down.
10. Enter @Input2@ into the Parameter field.
11. Enter Output2 into the Variable Name field.
12. Click Save Step to save this step and close the window.
Variable Set: Current ClientID Variable
Assigns the client ID, of the computer on which the script is running, to the variable. This function
runs on the server.
Parameters:
Set Type: Select Current ClientID from the drop-down.
Parameter: N/A
Variable Name: Variable name without @.
Example:
Assigns the ClientID to the variable Output1.
Parameters:
o
Set Type: Current ClientID
Parameter: N/A
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Current ClientID from the Set Type drop-down.
4. Leave the Parameter field blank.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
796
Variable Set: Current ComputerID Variable
Assigns the computer ID, of the computer on which the script is running, to the variable. This function runs on the server.
Parameters:
Set Type: Select Current ComputerID from the drop-down.
Parameter: N/A
Variable Name: Variable name without @.
Example:
Assigns the ComputerID to the variable Output1.
Parameters:
o
Set Type: Current ComputerID
Parameter: N/A
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Current ComputerID from the Set Type drop-down.
4. Leave the Parameter field blank.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
798
VariableSet: Current Console Number Variable
Assigns the console number, of the current user of the computer on which the script is running, to
the variable. This function runs on the server.
Parameters:
o
Set Type: Select Current Console Number from the drop-down.
Parameter: N/A
Variable Name: Variable name without @.
Example:
Assigns the console number to the variable Output1. The function example assumes that you have
used the IF Console Logged On function to determine which console is in use.
Parameters:
o
Set Type: Current Console Number
Parameter: N/A
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Current Console Number from the Set Type drop-down.
4. Leave the Parameter field blank.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
800
Variable Set: Current LocationID Variable
Assigns the location ID, of the computer on which the script is running, to the variable. This function
runs on the server.
Parameters:
o
Set Type: Select Current LocationID from the drop-down.
Parameter: N/A
Variable Name: Variable name without @.
Example:
Assigns the LocationID to the variable Output1.
Parameters:
o
Set Type: Current LocationID
Parameter: N/A
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Current LocationID from the Set Type drop-down.
4. Leave the Parameter field blank.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
802
Variable Set: Expand on Agent Variable
Agent assigns a local value to the variable defined in the Variable Name parameter.
Parameters:
o
Set Type: Select Expand on Agent from the drop-down.
Parameter: Item to be expanded on agent. (agent variable or XML, Web, Reg, Ini files)
Variable Name: Variable name without @.
Example:
Assigns the contents of the 'Path' system environment variable of the agent computer to the @Output1@ replacement variable.
Parameters:
o
Set Type:Expand on Agent
Parameter: %Path%
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Expand on Agent from the Set Type drop-down.
4. Enter %Path% into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
804
Variable Set: File Contents Variable
Assigns the entire contents of a specified file to the variable. This function runs on the agent.
Parameters:
o
Set Type: Select File Contents from the drop-down menu.
Parameter: Full path and file name of the source file.
Variable Name: Variable name without @.
Example:
Assigns the contents of c:\windows\system32\drivers\etc\lmhosts.sam to the variable Output1.
Parameters:
o
Set Type: File Contents
Parameter: c:\windows\system32\drivers\etc\lmhosts.sam
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select File Contents from the Set Type drop-down.
4. Enter c:\windows\system32\drivers\etc\lmhosts.sam into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
806
Variable Set: File Date Variable
Assigns the date on which a specified file was last modified to the variable. This function runs on
the agent.
Parameters:
o
Set Type: Select File Date from the drop-down menu..
Parameter: Full path and filename of the source file.
Variable Name: Variable name without @.
Example:
Assigns the last date that c:\windows\system32\ping.exe was modified to the variable Output1.
Parameters:
o
Set Type: File Date
Parameter: c:\windows\system32\ping.exe
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select File Date from the Set Type drop-down.
4. Enter c:\windows\system32\ping.exe into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
808
Variable Set: File MD5 Hash Variable
Returns the MD5 Hash for the file specified in the Parameter field.
Parameters:
o
Set Type: Select File MD5 Hash from the drop-down menu..
Parameter: Full path and file name of file to be hashed.
Variable Name: Variable name without @.
Example:
Assigns the MD5 hash of c:\windows\system32\ping.exe to the variable Output1.
Parameters:
o
Set Type:File MD5 Hash
Parameter: c:\windows\system32\ping.exe
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select File MD5 Hash from the Set Type drop-down.
4. Enter c:\windows\system32\ping.exe into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
810
Variable Set: File Size Variable
Assigns the size (in bytes) of a file to the variable. This function runs on the agent.
Parameters:
o
Set Type: Select File Size from the drop-down menu.
Parameter: Full path and file name of file.
Variable Name: Variable name without @.
Example:
Assigns the file size of c:\windows\system32\ping.exe to the variable Output1.
Parameters:
o
Set Type: File Size
Parameter: c:\windows\system32\ping.exe
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select File Size from the Set Type drop-down.
4. Enter c:\windows\system32\ping.exe into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
812
Variable Set: File Version Variable
Assigns the version of a file to the variable. This function runs on the agent.
Parameters:
o
Set Type: Select File Version from the drop-down menu..
Parameter: Full path and filename of file.
Variable Name: Variable name without @.
Example:
Assigns the version of c:\windows\system32\ping.exe to the variable Output1.
Parameters:
o
Set Type:File Version
Parameter: c:\windows\system32\ping.exe
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select File Version from the Set Type drop-down.
4. Enter c:\windows\system32\ping.exe into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
814
Variable Set: Get Virus Scanner Variables
Assigns values to %VirusProgram%, %VirusProgramArgs% and %VirusUpdate% from the
LabTech database for the computer on which the script is running.
Parameters:
o
Set Type: Select Get Virus Scanner Variables from the drop-down menu..
Parameter: Virus scanner for computer on which the script is running.
Variable Name: N/A
Example:
Assigns values to virus scanner variables.
Parameters:
o
Set Type:Get Virus Scanner Variables
Parameter: %virusscanner%
Variable Name: N/A
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Get Virus Scanner Variables from the Set Type drop-down.
4. Enter %virusscanner% into the Parameter field.
5. Leave the Variable Name field blank.
6. Click Save Step to save this step and close the window.
816
Variable Set: Properties Variable
Assigns the value of an existing LabTech Property to the variable. This function runs on the server.
Parameters:
o
Set Type: Select Properties from the drop-down menu.
Parameter: Property name.
Variable Name: Variable name without @.
Example:
Assigns the value defined by the 'ReportCompanyName' property to the variable Output1.
Parameters:
o
Set Type:Properties
Parameter: ReportCompanyName
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Properties from the Set Type drop-down.
4. Enter ReportCompanyName into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
818
Variable Set: Registry Variable
Assigns data from the registry to the variable. This function runs on the agent.
Parameters
o
Set Type:Select Registry from the drop-down menu.
Parameter: The registry key, subkey(s) and name that contains the data to be assigned to
the variable.
Variable Name: Variable name without @.
NOTE: 'This function is only compatible with Windows operating systems.
Example
Assigns data retrieved from the registry value HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\LanmanWorkstation to the variable Output1. This function example will only
execute on computers with a Windows OS.
Parameters:
o
Set Type:Registry
Parameter: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\LanmanWorkstation
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Registry from the Set Type drop-down.
4. Enter HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\LanmanWorkstation into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
820
Variable Set:Reload Computer Variables
Refreshes previously loaded variables. Enter a ComputerID to load variables for a specific computer.Use to change a client script into a computer script or change the computer on which a script
is running. This function runs on the server.
Parameters:
o
Set Type: Select Reload Computer Variables from the drop-down menu..
Parameter: Computer ID (Optional parameter).
Variable Name: Variable name without @.
Example:
Loads the local variables for the computer on which the script is running.
Parameters:
o
Set Type:Reload Computer Variables
Parameter: N/A
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Reload Computer Variables from the Set Type drop-down.
4. Leave the Parameter field blank.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
822
Variable Set: Split Name Value Parameter Variables
Assigns values to paired variables specified in a list of name/value pairs. This function runs on the
server.
Parameters:
o
Set Type: Select Split NameValue Parameter from the drop-down menu..
Parameter: A pipe (|) separated list of name/value pairs.
Variable Name: N/A
Example:
Assigns the specified value to the associated variable as defined by the pipe separated list.
Parameters:
o
Set Type:Split NameValue Parameter
Parameter: Output1=rectangle|Output2=square|Output3=circle
Variable Name: N/A
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Split NameValue Parameter from the Set Type drop-down.
4. Enter Output1=rectangle|Output2=square|Output3=circle into the Parameter field.
5. Leave the Variable Name field blank.
6. Click Save Step to save this step and close the window.
824
Variable Set: SQL Query Variable
Assigns only the first column of the first record of the SQL query result to the variable. This function
runs on the server.
Parameters:
o
Set Type: Select SQL Query from the drop-down menu..
Parameter: SQL query to retrieve value from database.
Variable Name: Variable name without @.
Example:
Assigns the result of the SQL query to the variable Output1.
Parameters:
o
Set Type:SQL Query
Parameter: SELECT `ProductName` FROM `LabTech`.`inv_chassis` WHERE `ComputerID` = %computerid%;
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select SQL Query from the Set Type drop-down.
4. Enter SELECT `ProductName` FROM `LabTech`.`inv_chassis` WHERE `ComputerID` = %computerid%; into the Parameter field.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
826
Variable Set: Temp Directory Variable
Assigns the Temp directory path, of the computer on which the script is running, to the variable.
This function runs on the server.
Parameters:
o
Set Type: Select Temp Directory from the drop-down menu..
Parameter: N/A
Variable Name: Variable name without @.
Example:
Assigns the Temp directory path to the variable Output1.
Parameters:
o
Set Type: Temp Directory
Parameter: N/A
Variable Name: Output1
Using the function example in a new or existing script :
1. From a new or existing script, right-click a line in the Then or Else section, select Add to
open the Edit Script Step window.
2. Select Variable Set from the Function drop-down.
3. Select Temp Directory from the Set Type drop-down.
4. Leave the Parameter field blank.
5. Enter Output1 into the Variable Name field.
6. Click Save Step to save this step and close the window.
828
This page intentionally left blank to ensure new
chapters start on right (odd number) pages.
830
INDEX
Check Type 66, 257
Maintenance Modes 416, 418
Commands
Messaging 380
Resend Inventory 586
P
Shutdown 196
Pager 399
User's Desktop 380
Ping 499
Crystal Reports 754, 756
Properties
D
Template 236
Disk Cleanup 150
R
E
Event Log Check 54
L
Login to use for Administrator
Access 310, 316, 330, 731
Redirectors
Telnet 479, 482-483, 485, 487, 561,
565, 569, 573
Refreshes 822
RegEx 652
Registry Check 94, 275
LTShare 320, 322, 334
Reinventory Devices 376
LTSVC 504
Reports
Inventory Reports 754, 756
Rescan Network 378
S
Schedules 439, 656
Server Address 420, 504
Skip Missing Virus Scanner 58
SMART 106, 283
Status 44, 122, 246, 292, 302
T
Temp Directory 828
TFTP 504, 590
Ticket Policy 202
Tickets
Elevating 773
Reading View 779
Tools and Tweaks 293, 758
Tray
Screen Capture 530
V
Virus Scan 433
Virus Scanner 816
W
Wake on LAN 507
Windows Update 435, 439, 442, 444, 446,
450, 453, 592, 600
Windows Update Settings 435, 437, 439,
442, 444, 446, 448, 450, 453
832