Hi all, is there a possibility to execute a powershell rule locally on the MS ? I have seen something in a post by Kevin Holman, but it was not exactly targeted to PowerShell.
Have you heard of the PowerShell Authoring MP?
Create the rule using this MP, target the Windows Computer class, ensure it’s disabled by default. Enable it only for your management servers.
Hi Dimitri, hope all is well.
This is possible, we do this for collecting shutdown events and to put them into maintenance mode.
There are two parts that are important here in our example.
- Tell the rule in a write action that it should be executed on a management server. In this example, look for the Target=””. CollectionManagementServer tells the script to execute on any Management Server in your environment.
<WriteAction ID=”PS” TypeID=”Digital.Operations.Autonomous.Maintenance.Mode.Start.Computer.Maintenance.WA” Target=”SC!Microsoft.SystemCenter.CollectionManagementServer“>
- The TypeID of the Write action (Digital.Operations.Autonomous.Maintenance.Mode.Start.Computer.Maintenance.WA) is a custom module that executes a PowerShell script with the parameters defined above.
Part of the custom module looks like this:
<WriteAction ID=”PS” TypeID=”Windows!Microsoft.Windows.PowerShellWriteAction”>
Please reach out if you need further assistance. You know where to find me.
OpsLogix / Approved