PowerShell Script Test

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
C0deBreak3r
Posts: 5
Joined: Wed Mar 16, 2016 5:12 pm
Location: London

PowerShell Script Test

Post by C0deBreak3r »

Hi,

Is it possible to pass the %LastReply% value of a PowerShell Script Test Item to a variable within a PowerShell Script as a Parameter? If so, could you provide an example of how this can be achieved?

I want to write a PowerShell Script to check how many Active Directory User Account Objects are currently active within Active Directory and then compare the current reply from within the script for counting user objects to that of the last reply from when the script was last executed.

I intend to use percentage based increase in user account objects, for example: if the last reply equalled 1400 user accounts I need to be able to retrieve this value from Hostmonitors LastReply variable so that I can then perform a percentage based comparison between the previous test result and current test result and then send back an bad status if there has been a sudden increase or decrease in user accounts (say 20% for example).

I know how to develop a PowerShell Script for this behaviour, I just don't know how I go about passing the LastReply value to the script.

Kind Regards

Craig
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You cannot use this variable as parameter of the test but I don't think you need script to compare old and new reply.
You may use Optional Status Processing
http://www.ks-soft.net/hostmon.eng/mfra ... processing

You may use option like
- Use Warning status if (((%Reply%-%SuggestedReply%)*100 div %SuggestedReply%) > 20) or (((%SuggestedReply%-%Reply%)*100 div %Reply%) > 20)

Regards
Alex
C0deBreak3r
Posts: 5
Joined: Wed Mar 16, 2016 5:12 pm
Location: London

Post by C0deBreak3r »

KS-Soft wrote:You cannot use this variable as parameter of the test but I don't think you need script to compare old and new reply.
You may use Optional Status Processing
http://www.ks-soft.net/hostmon.eng/mfra ... processing

You may use option like
- Use Warning status if (((%Reply%-%SuggestedReply%)*100 div %SuggestedReply%) > 20) or (((%SuggestedReply%-%Reply%)*100 div %Reply%) > 20)

Regards
Alex

Thanks Alex, will give this a go.
C0deBreak3r
Posts: 5
Joined: Wed Mar 16, 2016 5:12 pm
Location: London

Post by C0deBreak3r »

KS-Soft wrote:You cannot use this variable as parameter of the test but I don't think you need script to compare old and new reply.
You may use Optional Status Processing
http://www.ks-soft.net/hostmon.eng/mfra ... processing

You may use option like
- Use Warning status if (((%Reply%-%SuggestedReply%)*100 div %SuggestedReply%) > 20) or (((%SuggestedReply%-%Reply%)*100 div %Reply%) > 20)

Regards
Alex
One other question, I am setting up another PowerShell Script for reporting when an Administrator Password was last set, it returns a reply in the date format as: 03/17/2016 19:59:01 (MM/DD/YYYY HH:MM:SS), is it possible to configure a warning status to report if the date has changed since the previous reply?
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You may use "Use Warning status if" option with expression like the following:
'%SuggestedReply%'<>'%Reply%'
C0deBreak3r
Posts: 5
Joined: Wed Mar 16, 2016 5:12 pm
Location: London

Post by C0deBreak3r »

C0deBreak3r wrote:
KS-Soft wrote:You cannot use this variable as parameter of the test but I don't think you need script to compare old and new reply.
You may use Optional Status Processing
http://www.ks-soft.net/hostmon.eng/mfra ... processing

You may use option like
- Use Warning status if (((%Reply%-%SuggestedReply%)*100 div %SuggestedReply%) > 20) or (((%SuggestedReply%-%Reply%)*100 div %Reply%) > 20)

Regards
Alex

Thanks Alex, will give this a go.
Worked perfectly, thanks again.
C0deBreak3r
Posts: 5
Joined: Wed Mar 16, 2016 5:12 pm
Location: London

Post by C0deBreak3r »

KS-Soft Europe wrote:You may use "Use Warning status if" option with expression like the following:
'%SuggestedReply%'<>'%Reply%'
Ah, of course, should have known it would be as easy as that <feeling stupid> :oops:

Thanks again!
Post Reply