Solved 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?
1 2 3 4 5 |
# 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
1 |
$Target/Host/Property[Type=”SystemLibrary7585010!System.Entity”]/DisplayName$$Target/Property[Type=”SystemLibrary7585010!System.Entity”]/DisplayName$ |
Best answer
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]
You can ignore the params side, figured out, it was how i selected it, lack of semicolon was the problem.
Answer this question
To reply or comment, use the 'Comment' link on the relevant answer or question.