Run Locally

If you select the “Run Locally” button, you will get a Path and Arguments textbox instead of the script selector.

 

These tools will run on the users’ local computer in the local users context. The tool must either be installed on the users’ computer or accessible from a network location.

 

In the following example, we will create a tool that launches an already installed program, Notepad, on a users’ computer.

 

Arguments

Any arguments in the “Arguments textbox” will be added after the file path, exactly as writing. Please note that arguments are passed as clear text to the client.

 

Parameters

You can choose 4 types of parameters.

 

Computers- will add a drop-down box where the user can select a computer. The parameter is passed as

/ResourceID <value>

The value is an integer.

 

Users - will add a drop-down box where the user can select a user. Note that the user list comes from the SCCM user discovery and not the Active Directory. The parameter passed as

/Username <value>

The value is a string in the format “domain\username”.

 

Packages - will add a drop-down box where the user can select a package or application. The parameter passed as

/PackageID <value>

The value is a string with the SCCM package id.

 

Text- will add a textbox where the user can type any parameter. Any text written by the user in this textbox, will be passed after the path and the arguments.

 

PowerShell Scripts

If you wish to launch a powershell script, you must write the path to PowerShell.exe on the local machine in the Path textbox and the path to the powershell script in the Arguments textbox:

Note that execution of powershell scripts must be enabled on the local computers running this tool. Remember that there are two powershells in Windows, one for for 32 bit processes and one for 64 bit processes. The "normal" powershell is the 64 bit, but SoftwareCentral will launch the 32 bit powershell if the browser is a 32 bit program. You should enable execution of powershell scripts on both powershell versions.

Note that if your script requires one or more of the parameters, e.g. the resource id, you must call your parameter in the script the same as the parameter that is passed.

The following example demonstrates how to get the computer name from the ResourceID that is passed to the script:

PowerShell Example
Copy Code
Param(
[Int32]$ResourceID
)
# Web Service Parameters Start
[String]$strSiteCode = "[String]"
# Web Service Parameters End
# The object that will make the call to the Web Service
$proxy = New-WebServiceProxy -Uri "http://softwarecentral/Api/WS_Devices.asmx" -Class "Proxy" -UseDefaultCredential
# Call the Web Service
$result = $proxy.GetResourceNameById($ResourceID,$strSiteCode)
# Print the result if any
Write-Host $result

Note, that use the above example, you must provide grant the users calling the tool permissions to call the web service.

Read more about web service here.

See Also

 

 


© Copyright - SoftwareCentral

https://softwarecentral.cloud/help