Quantcast
Channel: Software Communities : Popular Discussions - ActiveRoles
Viewing all articles
Browse latest Browse all 1277

Issues Retrieving Task parameters in a scheduled task.

$
0
0

I'm having issues with retrieving task parameters in a scheduled task.

 

I'm running Version: 6.8.0.4269

 

I've tried the following two methods:

 

Method 1:  As per: http://communities.quest.com/message/18927#18927

 

function Get-Param($name)

{

foreach($v in $task.Dirobj.Parameters)

{

if ($v.name -eq $name)

{

$v.Value

break;

}

}

}

 

$OrgUnitToQuery = Get-Param("OrgUnitToQuery")

 

The debug info looks like this:

DEBUG: 123+ foreach($v in >>>> $task.Dirobj.Parameters)

Call '$Task.get_DirObj'

Call '$DirObj.Parameters'

DEBUG: ! SET $foreach = 'System.__ComObject System.__ComObject System.__ComObj...'.

DEBUG: 123+ foreach( >>>> $v in $task.Dirobj.Parameters)

DEBUG: ! SET $foreach = ''.

DEBUG: 131+ >>>> }

DEBUG: ! SET $OrgUnitToQuery = ''.

 

And the $OrgUnitToQuery value is blank.

If I added an eventlog entry in the ForEach block, but before the IF block, the EventLog is never fired (indicating to me that it THINKS that the object is empty.



 

Method 2: from the 6.8 SDK in the seciton titled: Using Parameters in Scheduled Task Scripts



$TestAuditOnly = $Task.DirObj.Parameters("TestAuditOnly")



And the script fails, and the debug info looks like this:



DEBUG: 164+ >>>> $TestAuditOnly = $Task.Dirobj.Parameters("TestAuditOnly")



 Call '$Task.get_dirobj'

ERROR:

At Line: 164 char:1. Method invocation failed because [Quest.ActiveRolesServer.Service.CorePolicies.PowerShellDirObj] doesn't contain a method named 'Parameters'.



What am I missing?  This is driving me batty.

 

P.S.  The rest of the script functions fine when executing in PowerGUI.


Viewing all articles
Browse latest Browse all 1277

Trending Articles