Configuring PowerShell for Intermapper
Before you can use PowerShell probes or notifiers, you need to configure the Intermapper machine and any target machines to allow connections. There are many options, and an exhaustive tutorial is beyond the scope of this topic.
For more information, see overview to using PowerShell on remote computers.
Enabling PowerShell Remoting
To enable PowerShell remoting, open a PowerShell window and run the following command (also known as a cmdlet) on all the machines you want to connect to:
Enable-PSRemoting -Force
The command starts the WinRM service, configures it to start automatically, and creates a firewall rule that permits incoming connections. The -Force attribute accepts the default settings.
- You must be logged in as an administrator to execute these commands.
- If both the local and remote computers are in a domain, enable PowerShell Remoting only on remote machines.
- If the local and remote computers are not in a domain, enabling remoting on the local machine is recommended. Among other things, it allows you to access and modify TrustedHosts, which is required in order to connect to a remote computer.
Configuring TrustedHosts
TrustedHosts is a list of trusted resources for your computer. The TrustedHosts list consists of a comma-separated list of computer names, IP addresses, and fully-qualified domain names. For a given computer, only administrators can change the TrustedHosts list.
Before you can connect to a remote computer, your TrustedHosts list must contain the IP address of that computer.
If your computers are not on a domain, you need to configure the TrustedHosts setting on the Intermapper server for all the computers you want to connect to. Execute these commands, providing an IP address, or use wildcards to specify an IP range (see below). Separate entries with commas (,).
Setting the Value of TrustedHosts
The following is a sample command that sets values in TrustedHosts:
Set-Item wsman:\localhost\client\trustedhosts [IP address],[IP address], ... Restart-Service WinRM
Using Wildcards When Configuring TrustedHosts
When configuring TrustedHosts, PowerShell accepts only a single asterisk (*) as a wild card.
The following are not allowed:
...\trustedhosts *.*.*.*, 192.168.*.*
The following are allowed:
...\trustedhosts *, 192.*, 192.168.*
Testing the Connection
To test the configuration, execute the following command:
Test-WsMan [COMPUTER]
A successful test shows a several lines of information. The last line is most interesting, as it shows the version of Microsoft Windows Management (WsMan) running on the target machine.
Executing a Command
You can now try a command. To determine the versions of PowerShell and several other related systems, run the following command:
Invoke-Command -ComputerName [Target Computer] -ScriptBlock { $PSVersionTable } -credential [UserName]
This returns a list of versions of PowerShell, WsMan, and other systems.
If the command runs successfully, you can try running PowerShell probes and notifiers.