Retrieving Schedule-Variables
Retrieving Schedule-Variables
Gets objects of the type "schedule". The source can be specified (either a DSM object that has a schedule property or a schedule variable or another schedule object) and the format to be used.
Examples:
Hint: The execution of these examples requires a connected PowerShell drive. |
In the first example, the value "Maintenance Timeframe" of the property group "Maintenance Plan" of the computer "WIN10-01" is retrieved. This is the default property of this data type and therefore it does not need to be explicitly specified:
$MyComputer = Get-EmdbComputer "WIN10-01" -Recurse Get-EmdbSchedule -Item $MyComputer -Format DisplayTable |
The value of the Format parameter can take on the values listed in the following table:
<format> |
Display |
Corresponds to |
PassThru |
Value as [EmdbTimeTable] object |
$MySchedule |
String |
Value as string (as in DSM database) |
$MySchedule.ToString(), $MySchedule.ToString("S“) |
DisplayTable |
Value displayed as a table (as in DSM protocols) |
$MySchedule.ToDisplayString("All", [DateTime]::Now, $null, $true, $null), $MySchedule.ToString("TFM“) |
Hashtable |
Value as hashtable |
$MySchedule.ToHashtable() |
If you retrieve the value of a property or a variable of a DSM object of the type "Schedule" directly, you get the value as it is stored in the DSM database, namely a string value. To convert this into an object of the type "Schedule" with the desired format, proceed as follows:
$MyComputer = Get-EmdbComputer "WIN10-01" -Recurse $MyScheduleString = $MyComputer.GetVariableValue("Schedule") $MySchedule = Get-EmdbSchedule -Schedule $MyScheduleString -Format HashTable |
For the String format, an additional Options parameter with format options for the string can be specified.
Get-EmdbSchedule -Item <Objekt> -Format String -Options <Formatoptionen> |
The format options can be specified as listed in the following table.
<format option> |
Effect |
S |
Value as string (as in DSM database) |
T, TA |
Value displayed as a table (as in DSM protocols) - also applies to all other format options |
TW |
Value as table - weekly schedule only |
TY |
Value as table - annual schedule only |
M |
Current day or hour is marked (as in DSM protocols: [X] ) |
M(<date/time>) |
The specified time (day / hour) is marked |
F |
Full names for days of the week and months |
L(<language/culture>) |
Names for days of the week and months are displayed in the specified language. |
C(<Active><Inactive><User can activate><User can deactivate>) |
Characters used to represent activation. Default would be "C(YNyn) |
The format options can be combined - example:
Get-EmdbSchedule -Schedule $MySchedule -Format String -Options "TFML(de)C(JNjn)" |