I am trying to evaluate a value from a powershell command for a SQL Agent setting on a clustered server using powershell. I am very new to Powershell but we want to set up a monitor to make sure that all of our Windows Server 2008 r2 clusters have this setting correct.
I did find the setting in question by using the following at a PS prompt...
cluster resource 'SQL Server Agent' /prop : RestartAction
The issue is I would like it to return just the number (either 1 or 1(0x1) would be fine) under the Value column in the following output.
Listing properties for 'SQL Server Agent':
T Resource Name Value
-- -------------------- ------------------------------ -----------------------
D SQL Server Agent RestartAction 1 (0x1)
Because this will be a monitor I need to be able to evaluate if the Value is = 1 or not and then report when it isn't. If I could get the powershell to just return the simple value I can do the rest of setting up the monitor in T-SQL.
I have been scouring the internet trying to find an answer but everything has to do with cmdlets and functions and all I want is the windows server value to be returned. Maybe it is not really that simple but I wanted to check before going down a long scripting venture.
I appreciate any help, thanks!!