SCOM Powershell management pack

Hi,

 

Had a query, it seems the powershell script will only run on the server the alert is generated for, if the script relies on a module that’s not widely pushed out, is there any way to always run the script from one server with the alert details?

 

Also i have the below script that outputs the args to a txt file, but it seems to be outputing blank lines, am i doing anything wrong with handling the arguments?

 

# Any Arguments specified will be sent to the script as a single string.
# If you need to send multiple values, delimit them with a space, semicolon or other separator and then use split.
param([string]$Arguments)

$Arguments | out-file “C:\expand.txt”

Params selected below

 

$Target/Host/Property[Type=”SystemLibrary7585010!System.Entity”]/DisplayName$$Target/Property[Type=”SystemLibrary7585010!System.Entity”]/DisplayName$

You can ignore the params side, figured out, it was how i selected it, lack of semicolon was the problem.

Sure, all i did was follow the instructions above haha, added the semicolon and let PS handle the param

 

$Target/Property[Type=“SystemLibrary7585010!System.Entity”]/DisplayName$;$Target/Host/Property[Type=“SystemLibrary7585010!System.Entity”]/DisplayName$

 

in my PS Code

$targetServer = $Arguments.Split(";")[1]
$driveLetter = $Arguments.Split(";")[0]

Can you show us how this should look? Just in case anyone else has the same issue :wink: