The Ranger PowerShell module is a powerful set of commands for automating many of the administrative functions of Ranger application.
Installing theRanger PowerShell extensions
The Ranger PowerShell commands are available in a PowerShell module available from the Download page. Copy this on the server you wish to run commands before executing any Ranger PowerShell scripts. Extract the files to anywhere on the path listed in the PSModulePath. Microsoft do not recommend using the C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ directory for non-system modules. (Details on Microsoft's recommendations for setting up a PowerShell you can read the details here) If you do not have another directory we suggest the following:
- Create the directory %ProgramFiles%\WindowsPowerShell\Modules\EZUDM
- Extract the files in EZUDM.zip that you downloaded into this directory
- Add the directory to the PSModulePath path
PowerShell should be started in Administrative mode to avoid permissions issues. To start PowerShell in administrative mode, right click the PowerShell icon and select "Run as administrator"
If you are running Windows 8/2012 or higher, the module will load automatically as required. Older versions of Windows require you to run:
Most Ranger PowerShell commands require authentication to the Ranger server. There are three ways to enter credentials for usage in PowerShell scripts:
- In direct response to the connect-UDMServer command. When you do not specify the -credentials switch you will be prompted to enter your logon credentials.
- Direct entry via standard Windows authentication prompts. This is the most secure method and is suitable for scripts that are run interactively by an administrator.
- Securely stored password in a text file on a computer. This is less secure but is suitable for unattended scripts running on an automated schedule.
We recommend using either method 1 or 2 for ease of use and security unless you require the use of scheduled, unattended script execution.
Simply run the following command to securely enter your Ranger credentials for use with other Ranger PowerShell commands:
File Stored Password
This is a multistep process that is performed once in order to securely store the password for automated script usage. To run this script, you must log onto the selected server that will be running the unattended script as the account used for script execution. The file generated by this process is only usable from the computer and user account where it was generated.
- Enter the password and store it in a secured variable by running $SecurePassword = Read-Host -Prompt "Enter password" -AsSecureString
- Store the encrypted password in a text file by running Out-File -InputObject ($SecurePassword | ConvertFrom-SecureString) -FilePath Password.txt
Once complete, the password will be available for any unattended script. To retrieve the encrypted password for use in scripts, use these line in your script:
$UserName = "<RangerUserName>"
$Password = Get-Content Password.txt | ConvertTo-SecureString
$Cred = New-Object System.Management.Automation.PsCredential($UserName, $Password)
The credentials are now available for use in commands requiring authentication.
Connecting to the Ranger Server
Before running any Ranger-specific PowerShell commands, you have to connect to the Ranger server using the following command, if you do not enter the -credentials switch you are prompted to enter logon credentials at this point.
Connect-UDMServer -Server https://<Ranger ServerFQDN> -credentials $Cred
Once the above is complete, you will be able to run scripts and commands as required. Once you have connected to the server you will be able to issue Ranger PowerShell commands for the duration of the session..
For a complete list of the available commands please click see the PowerShell Commands page.
Example scripts, templates, etc.
For example scripts, data templates, and more, see /wiki/spaces/RAN/pages/99198801.
Where to download
The Ranger PowerShell Module can be downloaded free from the Enoten web site at https://enoten.com/download.