|
OS commands |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Operating System Commands $GetUserName[server, group, offset ] $System[Network, HostAddress, hostname ] $System[Network, HostName, address ] %System[Process, Info, AvgUtil] $System[WinEventLog, action, spec, options] $System[WinEventLog, Open, logfile, options] $System[WinEventLog, NumEvents] $System[WinEventLog, RestartRead, time] $System[WinEventLog, ReadEvent] $System[WinEventLog, EventInfo, eventinfo] $System[WinEventLog, WaitForEvent] $System[WinEventLog, Clear, savepath] $System[WinEventLog, Backup, savepath] $System[WinReg, Option, path, spec] $System[WinReg, EnumKeys, keypath, position ] $System[WinReg, EnumValues, keypath, position ] %System[WinServ, serviceenum, type, servername] $System[WinServ, ServiceInfo, position, serviceinfo ] $System[WinShell, action, spec.] %System[WinSys, action, option] DescriptionWill retrieve the offset count of a username from the specified server and group. Syntax$GetUserName["Server, Group, Offset"] ReturnsString value. Example$username = $GetUserName["FSTEST1, DEVELOPMENT, 3"] Writecon "The third user in group DEVELOPMENT" Writecon "on FSTEST1 is = ",$username DescriptionReturns Windows NetWare Unix as operating system types for the current target agent. Syntax$OSName Returns$: Returns "Windows", "Netware", or "Unix" % Returns 0 for windows, 1 for NetWare, or 2 for Unix Examplewritecon "Operating system = ", $osname; “%:”,%osname DescriptionGets the OS Type. Syntax$OSType ReturnsIf windows: $%: it returns "NT” or 0, "95/98" or 1, or "3.1" or 3 If NetWare: $%: returns "Netware" or 1000 If Unix: $%: returns "Unix" or 2000 Examples$type = $OSType DescriptionGets name of OS. Syntax%OSName Returns$: returns "Windows", "Netware", or "Unix" %: returns 0 for windows, 1 for netware, or 2 for unix Examples$os = $OSName DescriptionDisplays environment variables Syntax$ScanENV[index] ExampleFor x = 0 to 23 $tmp = $scanenv[x] writecon "scanenv= ", $tmp next ReturnsEnvironment variable associated with the index. DescriptionGet IP address for host Syntax$System["Network, HostAddress, host"] Where: hostname: name of host Returns$: ip address in "1.2.3.4" format Example$ip = $System["Network, HostAddress, quantum"] DescriptionGet host name for IP address Syntax$system["Network, HostName, address"] Returns$: host name for IP address Example$host = $System["Network, HostName, 204.23.53.2"] DescriptionRetrieve the average agent utilization over the last ten minutes for the default Target Agent. Syntax%System["Process, Info, AvgUtil"] ReturnsNumeric value. RemarksCurrently only works on NT4 Unit of measurement = percentage. ExampleWritecon “Average utilization = “, %System["Process, Info, AvgUtil"] %System[Process, Info, Util]DescriptionThis identifier retrieves the utilization percentage for the default Target Agent.xe "%ServerUtil"xe "MXIs:%ServerUtil"xe "determining:utilization percentage"xe "utilization percentage" Syntax%System["Process, Info, Util"] ReturnsNumeric value. RemarksCurrently only works on NT4 Unit of measurement = percentage. ExampleWritecon "%Utilization = ",%System["Process, Info, Util"]
Examples%tmp = %System["WinEventLog, Open, Application"] %tmp = %System["WinEventLog, Open, c:\application.bak, file"] %tmp = %System["WinEventLog, Close"] %numevents = %System["WinEventLog, NumEvents"] %tmp = %System["WinEventLog, RestartRead"] %tmp = %System["WinEventLog, RestartRead, ", %TimeNow] %isevent = %System["WinEventLog, ReadEvent"] $type = $System["WinEventLog, EventInfo, type"] %tmp = %System["WinEventLog, Clear"] %tmp = %System["WinEventLog, Clear, c:\application.bak"] %tmp = %System["WinEventLog, Backup, c:\application.bak"] DescriptionOpen the specified log file Syntax$System[“WinEventLog, Open, logfile, options”] Where: logfile: specifies the log file to open, can be "Application", "Security", "System", or the path to a backed up log file if the "file" option is specified. Options: "servername:", followed by servername- if specified, name of server to open log file on, if not specified log file is opened on local server "file"- specifies that logfile is the path of a backed up log file "backward"- specifies that the log is to be read in reverse chronological order (newest first), default is forward chronological order (oldest first) This must be called before any other eventlog command is called, and you must call the close command when you are done with this logfile. Examples:%tmp = %System["WinEventLog, Open, Application"] %tmp = %System["WinEventLog, Open, c:\application.bak, file"] DescriptionCloses the log file that was opened with the "Open" command. Syntax$System["WinEventLog, Close"] Example%tmp = %System["WinEventLog, Close"] DescriptionReturns the number of events currently in the event log Returns%$: number of events currently in the event log Example%numevents = %System["WinEventLog, NumEvents"] DescriptionResets the read position. Syntax$System["WinEventLog, RestartRead, time"] Where: time: if not specified or 0, resets the read position to the beginning, if specified and the read direction is forwards, will exclude all events before the specified time, if backward, will exclude all events after the specified time, the time is expressed as the number of seconds that have elapsed since midnight (00:00:00), January 1, 1970, GMT RemarksThis command is useful for reading only new events after the WaitForEvent" command has been called. Examples%tmp = %System["WinEventLog, RestartRead"] %tmp = %System["WinEventLog, RestartRead, ", %TimeNow] DescriptionRead an event in the event log, the "EventInfo" command is used to retrieve the event's parameters, each successive call to this command will return the next event. Syntax$System["WinEventLog, ReadEvent"] Returns:$%: returns “Yes” or 1 if there is an event and “No” or 0 if there are no more events. Example%isevent = %System["WinEventLog, ReadEvent"] DescriptionRetrieves event parameters for the event read by the "ReadEvent" command Syntax$System["WinEventLog, EventInfo, eventinfo"] Where: eventinfo: specifies which parameter to return, can be: "time" $: returns the date and (local) time the event was generated in the format "MM-DD-YYYY HH:MM:SS" %: returns the date and (gmt) time the event was generated as the number of seconds that have elapsed since midnight (00:00:00), January 1, 1970 "type" $: returns the type of event, can be "error" for error, "warning" for warning, "information" for information, "audit_succ" for success audit or "audit_fail" for failure audit %: returns the type of event, can be 0 for error, 1 for warning, 2 for information, 3 for success audit or 4 for failure audit. "source" $: returns the name specifying the source of the event. "category" $: returns the event category. "eventid" %$: returns the event id number. "computer" $: returns the name of the computer that generated the event. "user" $: returns the name of the user that generated the event or "Not_Found" if there is no user associated with the event. "numdesclines" %$: returns the number of description lines "descline:", followed by the zero based index of the line $: returns the specified description line. "numparams" %$: returns the number of event parameters "param:", followed by the zero based index of the parameter, $: returns the specified parameter or "Not_Found" if there are no more parameters. Example$type = $System["WinEventLog, EventInfo, type"] See the file Seceventdesc.html on the disk or on www.knozall.com for detailed information DescriptionWaits until an event is written to the event log Examples:%tmp = %System["WinEventLog, WaitForEvent"] DescriptionClears the specified log file and optionally backs it up. Syntax$System["WinEventLog, Clear, savepath"] Where: savepath: if specified, path of the file to save the logfile to before it is cleared, if not specified, logfile is not saved. Examples%tmp = %System["WinEventLog, Clear"] %tmp = %System["WinEventLog, Clear, c:\application.bak"] DescriptionBacks up the specified log file. Syntax$System["WinEventLog, Backup, savepath"] Where: savepath: path of the file where logfile will be saved. Examples:%tmp = %System["WinEventLog, Backup, c:\application.bak"] DescriptionGets or sets key parameters. Syntax$System[“WinReg, Option, keypath, spec”] Where: Path can be keypath or valuepath. keypath: specifies the path to the registry key, composed of an optional computer name (if the key you are changing is on another computer), followed by the main key name, followed by any sub keys followed by the value name (if the key is a path to a value) RemarksA remote key path must be specified by two backslashes, followed by thecomputer name, followed by one backslash followed by the rest of the key path. Only HKEY_LOCAL_MACHINE and HKEY_USERS can be used remotely. Exampleslocal: HKEY_LOCAL_MACHINE\SOFTWARE\Knozall HKEY_CLASSES_ROOT\mjbfile remote: \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall valuepath: same as keypath, but is used to identify a value instead of a key. examples: local: HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue remote: \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue
Examples$System[WinReg, CreateKey, keypath ]examples: %tmp = %System["WinReg, CreateKey, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall"] %tmp = %System["WinReg, CreateKey, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall"] $System[WinReg, DeleteKey, keypath ]examples: %tmp = %System["WinReg, DeleteKey, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall"] %tmp = %System["WinReg, DeleteKey, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall"] $System[WinReg, SetValue, valuepath, string, valuedata ]examples: %tmp = %System["WinReg, SetValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\value, string, data"] %tmp = %System["WinReg, SetValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\value, number, 100"] %tmp = %System["WinReg, SetValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\value, string, data"] %tmp = %System["WinReg, SetValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\value, number, 100"] $System[WinReg, SetValue, keypath, number, valuedata ]examples: %tmp = %System["WinReg, SetValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\value, string, data"] %tmp = %System["WinReg, SetValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\value, number, 100"] %tmp = %System["WinReg, SetValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\value, string, data"] %tmp = %System["WinReg, SetValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\value, number, 100"] $System[WinReg, GetValue, keypath ]examples: $strval = $System["WinReg, GetValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue"] %numval = %System["WinReg, GetValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\numvalue"] $strval = $System["WinReg, GetValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue"] %numval = %System["WinReg, GetValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\numvalue"] $System[WinReg, DeleteValue, keypath ]examples: %tmp = %System["WinReg, DeleteValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue"] %tmp = %System["WinReg, DeleteValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue"] $System[WinReg, GetValueType, keypath ]examples: $type = $System["WinReg, GetValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue"] %type = %System["WinReg, GetValue, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue"] $type = $System["WinReg, GetValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue"] %type = %System["WinReg, GetValue, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall\strvalue"] DescriptionEnumerates the registry keys in the key specified by keypath. Syntax$System["WinReg, EnumKeys, keypath, position"] Where: Keypath: keypath: specifies the path to the registry key, composed of an optional computer name (if the key you are changing is on another computer), followed by the main key name, followed by any sub keys followed by the value name (if the key is a path to a value). position: start at 0 for the first key and increment for next key. Examples$key = $System["WinReg, EnumKeys, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall, 0"] $key = $System["WinReg, EnumKeys, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall, 0"] DescriptionEnumerates the values in the key specified by keypath. Syntax$System["WinReg, EnumValues, keypath, position"] Where: Keypath: keypath: specifies the path to the registry key, composed of an optional computer name (if the key you are changing is on another computer), followed by the main key name, followed by any sub keys followed by the value name (if the key is a path to a value). position: start at 0 for the first key and increment for next key. Examples$value = $System["WinReg, EnumValues, HKEY_LOCAL_MACHINE\SOFTWARE\Knozall, 0"] $value = $System["WinReg, EnumValues, \\computer\HKEY_LOCAL_MACHINE\SOFTWARE\Knozall, 0"] ServiceEnum, type [, servername] DescriptionEnumerates services on specified server. Syntax%System["WinServ, serviceenum, type, servername"] Where: type: specifies type of services to enum, can be "win32" for win32 (regular) services, "driver" for driver services, or "all" for all services. servername: if specified, name of server to enum services on, if not specified, services are enumerated on local server. Returns%$: number of services enumerated RemarksEach call to this function destroys the previous ServiceEnum results. Example%numservices = %System["WinServ, ServiceEnum, win32"] %numservices = %System["WinServ, ServiceEnum, support, all"] DescriptionGets service parameters retrieved by "ServiceEnum" command. Syntax$System["WinServ, ServiceInfo, position, serviceinfo"] Where: Position: start at 0, incremement for next service serviceinfo: specifies which service parameter to return, can be: "Does_Exist" $%: returns “Yes” or 1 if there is a service at the specified position and “No” or 0 if there isn't a service at the specified position. "servicename" $: returns name of service. "displayname" $: returns display name of service. "Is_Win32" $%: returns “Yes” or 1 if service is a win32 (regular) service and “No” or 0 if it is a driver service. "State" $: returns "Stopped" if service is not running, "Started" if the service is running, "Paused" if the service is paused, or "Unknown" if unknown ReturnsDepends on serviceinfo, always returns "Not_Found" for $ or -1 for % if no more services left. Example$servicename = $System["WinServ, ServiceInfo, 0, servicename"] DescriptionSyntax$System[“WinShell, Action, spec”] Where: parameters: maingroup: one of the following: "Desktop", "NetHood", "Programs", "Start Menu", "Startup", "Common Programs",“Common Desktop", "Common Start Menu", "Common Startup" groupname: name of group, can include backslashes for hierarchical groups. itemname: name of item grouppath: maingroup\groupname itempath: grouppath\itemname
Examples$System[WinShell, CreateGroup, location \groupname ]name of group can include backslashes for hierarchical groups examples: $System["WinShell, CreateGroup, Programs\knozall"] $System["WinShell, CreateGroup, Common Programs\knozall"] $System[WinShell, CreateGroup, Common Desktop\Groupname ]name of group can include backslashes for hierarchical groups $System[WinShell, CreateGroup, Common Start Menu\Groupname ]name of group can include backslashes for hierarchical groups $System[WinShell, CreateGroup, Common Startup\Groupname ]name of group can include backslashes for hierarchical groups $System[WinShell, CreateGroup, Desktop\Groupname ]name of group can include backslashes for hierarchical groups $System[WinShell, CreateGroup, Nethood\Groupname ]name of group can include backslashes for hierarchical groups $System[WinShell, CreateGroup, Start Menu\Groupname ]name of group can include backslashes for hierarchical groups $System[WinShell, CreateGroup, Startup\Groupname ]name of group can include backslashes for hierarchical groups $System[WinShell, CreateGroup, Programs\Groupname ]name of group can include backslashes for hierarchical groups $System[WinShell, ShowGroup, Maingroup\Groupname ]$System[WinShell, DeleteGroup, Maingroup\Groupname ]examples: $System["WinShell, DeleteGroup, Programs\knozall"] $System["WinShell, DeleteGroup, Common Programs\knozall"] $System[WinShell, DeleteItem, Maingroup\Groupname\Itemname ]examples: $System["WinShell, DeleteItem, Programs\knozall\File Wizard V"] $System["WinShell, DeleteItem, Common Programs\knozall\File Wizard V"] $System[WinShell, AddItem, Maingroup\Groupname\Itemname, Args:args, ]command-line arguments, default is no args $System[WinShell, AddItem, Maingroup\Groupname\Itemname, Iconpath:iconpath, ]path of file that contains icon, default is target examples: $System["WinShell, AddItem, Programs\knozall\File Wizard V, c:\program files\file wizard\filewiz.exe"] $System["WinShell, AddItem, Common Programs\knozall\File Wizard V, c:\program files\file wizard\filewiz.exe"] $System[WinShell, AddItem, Maingroup\Groupname\Itemname, IconIndex:index,]Index of icon in icon file, default is 0 $System[WinShell, AddItem, Maingroup\Groupname\Itemname, Workdir:workdir]Working directory, default is no working directory $System[WinShell, AddItem, Maingroup\Groupname\Itemname, ShowCmd: Normal | Minimized | Maximized]Show command, default is “normal”, can be “normal”, “minimized”, or “maximized”. DescriptionWindows system functions commands. Can be used to exit windows, or shut down the system with various options. Syntax%System[“WinSys, Action, Option”]
ExamplesExamples: ExitWindows %tmp = %System["WinSys, ExitWindows, poweroff"] %tmp = %System["WinSys, ExitWindows, reboot"] Examples: ShutdownSystem %tmp = %System["WinSys, ShutdownSystem"] %tmp = %System["WinSys, ShutdownSystem, servername:quantum"] %tmp = %System["WinSys, ShutdownSystem, servername:quantum, reboot"] RemarksThis shutdown cannot be aborted by the user (unless they have some other program that will abort it such as shutdown.exe that comes with the NT resource kit), it must be aborted by the "AbortShutdown" command Example: AbortShutdown %tmp = %System[“WinSys, Abortshutdown, servername:quantum”]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||