- Products
- Solutions
- Resources
- Trials
- Support
- Partners
- Communities
Hi Ben,
Not sure about through Powershell but it looks reasonably easy through vbscript, is that an option maybe:
Set objSchT = GetObject("EDMS://CN=MyTask,CN=Scheduled Tasks,CN=Server
Configuration,cn=Configuration")
objSchT.Parameters("Par1") = "100"
objSchT.SetInfo
Thanks,
Ewan
For whatever reason, I find teh VBS method to be much simpler -- but here's a sample section from a PowerShell Scheduled Task that we are running in ARS 6.7:
All values (OverwriteFile, LogFilePath, LogFileName, Environment) are set via the GUI for the SchTask and read in at runtime...
Just plop your "Work Code" after this section that reads in your parameters...
Hope that helps you out...
---Clip---
#Read in the Parameters for the Task
$objTask = [ADSI]$Task.AdsPath
$params = $objTask.InvokeGet("Parameters")
$params | ForEach-Object -Process {
if ($_.'Name' -eq "OverwriteFile")
{
$SetOverWritePolicy = [string]$_.'Value'
}
elseif ($_.'Name' -eq "LogFilePath")
{
$strLogFilePath = [string]$_.'Value'
}
elseif ($_.'Name' -eq "LogFileName")
{
$strLogFile = [string]$_.'Value'
$strLogBackup = $strLogFile + "_backup"
}
elseif ($_.'Name' -eq "Environment")
{
$Environment = [string]$_.'Value'
}
}
---End---
The above code wouldn't work for me in ARS 6.5. I've resorted to reading the edsaParameters value directly. The below code will create a $params object with properties on that object corresponding to the parameter names configured for the scheduled task. Access the parameters like this: $params.MyFirstParamater $params.AnotherParameter
#Read in the Parameters for the Task,
#add them as properties on a $params object.
$objTask = [ADSI]$Task.AdsPath
$params = New-Object PSObject
$objTask.edsaParameters| %{
$xParameter=([xml]$_).DocumentElement
Add-Member -InputObject $params NoteProperty $xParameter.Name $xParameter.'#text'
}
Set-QADObject -Identity $NewTaskObjDN -ObjectAttributes @{edsaParameters=$edsaParameters}
In this case I copied the parameters from one task to another. The parameters are stored as an XML string so you could ( not tested ) construct this as follows:
$edsaParameters += "<DBName>DataBaseName\A</DBName>"