Scheduled Tasks Integration Pack: Practical Use

There is a question posed on the Opalis forums right now where a user is attempting to run a script to backup the management packs from their SCOM server.

Hello,

I’, trying to make a workflow in Opalis for backing up the management packs on my SCOM server – but without any luck.

First i tried making a .net script in Opalis which included the PS script to be run – but without any luck. Then I wanted to try saving following script on my SCOM server and running it localy:

add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”;

set-location “OperationsManagerMonitoring::”;

new-managementGroupConnection -ConnectionString:SERVERNAME;

set-location SERVERNAME;

Get-managementpack ¦ export-managementpack -path c:\BACKUPPATH

This worked without any problems, when running it localy. I then thought that it would be possible to share the script on the SCOM server and in my Run .NET script in my Opalis workflow point to the \\SCOMSERVER\SHARE\SCRIPT.PS1 and everything would be fine. But no. I get the following error.

File \\SCOMSERVER\SHARE\SCRIPT.PS1 cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details

What would be the best way of handling the backup of management packs? My idea is that the best way of handling this, would be having the while PS script in the Opalis .NET object, but I’m not quite sure how it is possible to get it working. Any ideas?

 

So, what I am going to do is create a policy that you can pass the below variables to and will run the script using the scheduled task engine to execute the script.

  • Share Location: Location to store the script on
  • Script Body: The body of the script
  • Script Name: The Name of the script
  • Script Parameters: Any parameters you would like to pass to the script
  • Computer Name: Name of the computer to execute the script on
  • Username: User Acct to run the script
  • Password: Password for the user account

 

So we can now test this to make sure it works!

Advertisements
Tagged with: , ,
Posted in Integration Pack
2 comments on “Scheduled Tasks Integration Pack: Practical Use
  1. Steve says:

    Any reason all my computers give the following error during the “create scheduled task”:
    Object reference not set to an instance of an object.

    • randorfer says:

      Hey Steve,

      This usually means that the account your actions server is running as does not have access to create scheduled tasks on the remote machine.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: