2885 Sanford Ave SW #35320 Grandville MI 49418, USA
Support@ITDynamicPacks.Net Info@ITDynamicPacks.Net

Creating and Using a General Dynamic Pack

5  Dec  

Creating and Using a General Dynamic Pack

One of the great features of DynamicPacks Health Profiler is that you can design custom Dynamic Packs using Dynamic Pack Manager. Dynamic Pack Manager ships with paid version of DynamicPacks Health Profiler. It is important to understand that you can design custom Dynamic Packs only based on the PowerShell cmdlets for the target systems.

There are two types of Dynamic Packs you can design; “General Dynamic Pack” and “List and Count Dynamic Pack”.  In case you're looking for an overview of Dynamic Packs, please check out this article.

Okay. Let's start then.

Before you start creating Dynamic Packs, please note:

  • You have purchased DynamicPacks Health Profiler in order to use Dynamic Pack Manager.
  • You have identified PowerShell cmdlet/code that you're going to use in Dynamic Pack.
Creating General Dynamic Packs       

A General Dynamic Pack can be designed using Dynamic Pack Manager. Here are the steps you need to follow to create a General Dynamic Pack.

Step 1: Open Dynamic Pack Manager from within the DynamicPacks Health Profiler by clicking "Open Dynamic Pack Manager" action as shown in the screenshot below.

Open-Dynamic-Pack-Manager

 Step 2: Once Dynamic Pack Manager is opened, click on the "Create New Dynamic Pack" button as shown in the screenshot below:

Create-New-Dynamic-Pack-button

When you click on "Create New Dynamic Pack" button, Dynamic Pack Manager will show you "Create New Dynamic Pack" window as shown in the screenshot below.

Create-New-Dynamic-Pack-Window

Step 3: Enter the following details:

  • Name: Give Dynamic Pack a name. When naming Dynamic Packs, please make sure to enter only letters.
  • Type: Select "General Dynamic Pack" in the dropdown list.

For now, leave other fields. We will create a simple Dynamic Pack.

Step 4: Click on "Create Dynamic Pack" button to register Dynamic Pack with Dynamic Pack Manager tool. You will be prompted before a Dynamic Pack is created as shown in the screenshot below:

Create-a-New-Dynamic-Pack-Confirmation

Clicking "Yes" will register new Dynamic Pack with Dynamic Pack Manager Tool. You can see new Dynamic Pack in the available Dynamic Packs tree as shown in the screenshot below. Note that newly created Dynamic Packs will appear under "User-Defined Dynamic Packs" node as shown in the screenshot below.

Dynamic-Pack-Tree

Step 5: Next task is to edit the Dynamic Pack code. Right Click on the Dynamic Pack you just created and then click on the "Modify Code" action on the Right Click context menu as shown in the screenshot below:

Modify-Dynamic-Pack-Code

Clicking on "Modify Dynamic Pack Code" action will show you existing Dynamic Pack code if you had entered previously. Since it is a new Dynamic Pack that we just created, we will see empty boxes as shown in the screenshot below.

Modify-Dynamic-Pack-Code-Window

As you can see in the above screenshot, there are two places where you need to enter the PowerShell code; "Code with Credentials" and "Code without Credentials".

Let me explain what these boxes are and why to enter PowerShell code at two places.

DynamicPacks Health Profiler supports executing Dynamic Packs under different credentials. By default, DynamicPacks Health Profiler uses "Locally Logged On Credentials" to execute Dynamic Packs against target systems. In case you need to execute a Dynamic Pack under different credentials, you must enter PowerShell code in "Code with Credentials" box.

On the other hand, if you want to execute a Dynamic Pack under "Locally Logged On Credentials", you will need to enter PowerShell code in "Code without Credentials" box.

It is recommended to enter PowerShell code at both the places.

Step 6: Creating PowerShell code for Dynamic Pack.

At this stage, you should be ready with the PowerShell code you want to integrate with the Dynamic Pack. There are thousands of scripts/PowerShell code available on the Internet. You can search for PowerShell code and integrate with Dynamic Pack.

For this example, we will be using a PowerShell code that helps us get "Up time" from Windows Servers. Before you start to design a PowerShell code for use with a Dynamic Pack, pay attention to the following requirements:

  • PowerShell Script/Code output must be stored in "$VarRepFile" variable.
  • When designing PowerShell credential code, use "$Creds" variable in the PowerShell code. You don't need to enter credential in the PowerShell code.

I have already designed a PowerShell code that I am going to use in this example as listed below.

$ServerList = ".\Data\ServerList.TXT"
Foreach ($ItemName in Get-Content "$ServerList")
{
$operatingSystem = Get-WmiObject Win32_OperatingSystem -ComputerName $ItemName -Credential $Creds
$RTime=Management.ManagementDateTimeConverter]::ToDateTime($operatingSystem.LastBootUpTime)
$ThisStr=$ItemName+","+$RTime
Add-Content "$VarRepFile" $ThisStr
}

As you can see in the above code, I'm using "$VarRepFile" variable to store PowerShell code output and "$Creds" variable for specifying credentials.

You must enter above code in the "Code with Credentials" box as shown in the screenshot below.

Modify-Dynamic-Pack-Code window-2

As you can see in the above screenshot, I have entered code at both the places (Code with Credentials and Code without Credentials).

What is the difference between these two codes? The only difference between code entered in "Code with Credentials" box and code entered in the "Code without Credentials" box is the use of "$Creds" variable. In simple words, "$Creds" variable is not used for code entered in the "Code without Credentials" box as indicated by a red circle in the above screenshot.

Note that I've also added a "Header code" in the "Main Header Code" box as shown in the screenshot above.

Next, click on Save-Dynamic-Pack-Code button to save the Dynamic Pack code.

Step 7: Okay. Dynamic Pack is created with a PowerShell code of your choice. Next is to use new Dynamic Pack in DynamicPacks Health Profiler.

Open DynamicPacks Health Profiler. In the "Configuration" pane, click on the "Add/Remove Dynamic Packs" Tab and then expand "User-Defined Dynamic Packs" in the tree. You will see the new Dynamic Pack in the list as shown in the screenshot below.

using-Dynamic-Pack-in-DynamicPacks-Health-Profiler

To add "My New Dynamic Pack" to a Health Profile, select a Health Profile from the list of Health Profiles shown in the Health Profiles tree > check "My New Dynamic Pack" Dynamic Pack > and then click on the "Add Packs".

Once Dynamic Pack is added to a Health Profile, you can execute newly created Dynamic Pack as part of Health Profile or execute Dynamic Pack individually using DynamicPacks Health Profiler console.

If you wish to add more General Dynamic Packs, use above as an example.

Please feel free to discuss this post here.

***

 

Recommend DynamicPacks Health Profiler