-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from NickETH/master
Update version check to R2024x
- Loading branch information
Showing
10 changed files
with
603 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Function Edit-bConnectJobWindowsOptions() { | ||
|
||
<# | ||
.Synopsis | ||
Creates a new WindowsOptions object for Jobs. | ||
Empty or filled with given information. | ||
.Parameter JobWindowsOptions | ||
A valid JobWindowsOptions object. | ||
.Parameter LatestLogOff | ||
If true the user will be logged off as late as possible. | ||
.Parameter LatestLogon | ||
If true the user will be logged on as late as possible. | ||
.Parameter LogoffUserBeforeJobStart | ||
If true the user will be logged off before job start. | ||
.Parameter UserDelayShutdown | ||
If true the user is able to delay shutdowns. | ||
.Parameter UseForceLogoff | ||
If true the user will be logged off even if there are unsaved changes. | ||
.Parameter UsersettingsPerUser | ||
If true, the user settings will be executed per user during software deployment. | ||
.Parameter WillReinstall | ||
If true, the job will reinstall the client. | ||
.Parameter IgnoreBandwidth | ||
If true, the job will be executed ignoring the configured MinBandwidth. | ||
.Parameter IgnoreBITS | ||
If true, the job will not support baramundi background transfer. | ||
.Parameter SupportEndpointsInInternetMode | ||
If true, the job will also be executed on clients which are currently roaming. | ||
.Outputs | ||
WindowsOptions object (see bConnect documentation for more details) | ||
#> | ||
|
||
[OutputType("System.Management.Automations.PSObject")] | ||
Param( | ||
[Parameter(Mandatory=$true)][PSCustomObject]$JobWindowsOptions, | ||
[bool]$LatestLogOff, | ||
[bool]$LatestLogon, | ||
[bool]$LogoffUserBeforeJobStart, | ||
[bool]$UserDelayShutdown, | ||
[bool]$UseForceLogoff, | ||
[bool]$UsersettingsPerUser, | ||
[bool]$WillReinstall, | ||
[bool]$IgnoreBandwidth, | ||
[bool]$IgnoreBITS, | ||
[bool]$SupportEndpointsInInternetMode | ||
) | ||
|
||
$_new_JobWindowsOptions = ConvertTo-Hashtable $JobWindowsOptions | ||
|
||
# We remove the input object from the argument hash table. | ||
# Because we want to iterate through it later. | ||
$TrashResult = $PSBoundParameters.Remove('JobWindowsOptions') | ||
|
||
Foreach($_property in $PsBoundParameters.GetEnumerator()) { | ||
# Write-Output ("Key={0} Value={1}" -f $_property.Key,$_property.Value) | ||
if($_new_JobWindowsOptions.($_property.Key)){ | ||
$_new_JobWindowsOptions.($_property.Key) = $_property.Value | ||
}else{ | ||
$_new_JobWindowsOptions.Add($_property.Key,$_property.Value) | ||
} | ||
|
||
} | ||
#Write-Output $_new_JobWindowsOptions | ||
return $_new_JobWindowsOptions | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
Function New-bConnectJob() { | ||
<# | ||
.Synopsis | ||
Create a new job. | ||
.Parameter Name | ||
Name of a job | ||
.Parameter DisplayName | ||
Display name of a job. Visible in the bMA TrayNotifier and Kiosk. | ||
.Parameter Type | ||
Job type: Windows, Mobile, Universal | ||
.Parameter Steps | ||
The job steps which the job will execute. | ||
.Parameter ParentId | ||
The GUID of the new jobs parent OU. | ||
.Parameter Id | ||
The GUID of the new job object, optional. | ||
.Parameter Category | ||
The job’s category. | ||
.Parameter Description | ||
The job’s description. | ||
.Parameter Comments | ||
Admin’s comment. | ||
.Parameter IconId | ||
The id of the job’s icon, which is visible in the Kiosk. | ||
.Parameter JobExecutionTimeout | ||
The execution timeout of the job. | ||
.Parameter AbortOnError | ||
If set to true the job aborts after an erroneous job step. | ||
.Parameter RemoveInstanceAfterCompletion | ||
If set to true the job assignment will be deleted after successful execution. | ||
.Parameter WindowsProperties | ||
The windows properties of the job. Must not be null if job is for windows endpoints. Must be null if job is for mobile or mac endpoints. | ||
.Parameter MobileAndMacProperties | ||
The mobile and mac properties of the job. Must not be null if job is for mobile or mac endpoints. Must be null if the job is for windows endpoints. | ||
.Parameter UniversalProperties | ||
The properties of a universal job. Must be null if the job is for windows or mobile endpoints. | ||
.Outputs | ||
NewJob (see bConnect documentation for more details). | ||
#> | ||
|
||
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'low')] | ||
[OutputType("System.Management.Automations.PSObject","System.Boolean")] | ||
Param ( | ||
[Parameter(Mandatory=$true)][string]$Name, | ||
[Parameter(Mandatory=$true)][string]$DisplayName, | ||
[Parameter(Mandatory=$true)][ValidateSet("Windows","Mobile","Universal",ignoreCase=$true)][string]$Type, | ||
[Parameter(Mandatory=$true)][PSCustomObject[]]$Steps, | ||
[string]$ParentId = "C6567FDB-74B4-40C1-846D-12011A163B4A", #guid of "Job Management" as fallback | ||
[string]$Id, | ||
[string]$Category, | ||
[string]$Description, | ||
[string]$Comments, | ||
[string]$IconId, | ||
[int]$JobExecutionTimeout = 0, | ||
[bool]$AbortOnError = $true, | ||
[bool]$RemoveInstanceAfterCompletion = $false, | ||
[PSCustomObject]$WindowsProperties, | ||
[PSCustomObject]$MobileAndMacProperties, | ||
[PSCustomObject]$UniversalProperties | ||
) | ||
|
||
$_connectVersion = Get-bConnectVersion | ||
If($_connectVersion -ge "1.0") { | ||
$_body = @{ | ||
# Id = $Id; | ||
Name = $Name; | ||
DisplayName = $DisplayName; | ||
Type = $Type; | ||
Steps = $Steps; | ||
ParentId = $ParentId; | ||
JobExecutionTimeout = $JobExecutionTimeout; | ||
AbortOnError = $AbortOnError; | ||
RemoveInstanceAfterCompletion = $RemoveInstanceAfterCompletion | ||
} | ||
|
||
If(![string]::IsNullOrEmpty($Id)) { | ||
$_body += @{ Id = $Id } | ||
} | ||
|
||
If(![string]::IsNullOrEmpty($Category)) { | ||
$_body += @{ Category = $Category } | ||
} | ||
|
||
If(![string]::IsNullOrEmpty($Description)) { | ||
$_body += @{ Description = $Description } | ||
} | ||
|
||
If(![string]::IsNullOrEmpty($Comments)) { | ||
$_body += @{ Comments = $Comments } | ||
} | ||
|
||
If(![string]::IsNullOrEmpty($IconId)) { | ||
$_body += @{ IconId = $IconId } | ||
} | ||
|
||
<# If($JobExecutionTimeout.HasValue()) { | ||
$_body += @{ JobExecutionTimeout = $JobExecutionTimeout } | ||
} | ||
If($AbortOnError.HasValue()) { | ||
$_body += @{ AbortOnError = $AbortOnError } | ||
} | ||
If($RemoveInstanceAfterCompletion.HasValue()) { | ||
$_body += @{ RemoveInstanceAfterCompletion = $RemoveInstanceAfterCompletion } | ||
} #> | ||
|
||
If($WindowsProperties) { | ||
$_body += @{ WindowsProperties = $WindowsProperties } | ||
} | ||
|
||
If($MobileAndMacProperties) { | ||
$_body += @{ MobileAndMacProperties = $MobileAndMacProperties } | ||
} | ||
|
||
If($UniversalProperties) { | ||
$_body += @{ UniversalProperties = $UniversalProperties } | ||
} | ||
|
||
if($PSCmdlet.ShouldProcess($_body.Name, "Create new job.")){ | ||
return Invoke-bConnectPost -Controller "Jobs" -Version $_connectVersion -Data $_body | ||
} else { | ||
return $false | ||
} | ||
} else { | ||
return $false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Function New-bConnectJobIntervall() { | ||
<# | ||
.Synopsis | ||
Creates a new Intervall object for Jobs. | ||
Empty or filled with given information. | ||
.Parameter IntervalType | ||
The type of the interval. | ||
.Parameter Days | ||
The list of valid days when specifying IntervalType “Weekdays”. Must be empty otherwise. | ||
.Parameter Multiplicator | ||
The hour/day/minute multiplicator. Can only be used when specifying IntervalTypes ‘EveryXDays’, ‘EveryXHours’ or ‘EveryXMinutes’ | ||
.Parameter StartTime | ||
The time the job will be started. Hour(from 0 – 23): Minute(from 0 - 59). | ||
.Parameter Repetitions | ||
The number of job repetitions. | ||
.Parameter RescheduleOnError | ||
The job will be rescheduled, even if the previous execution wasn’t successful. | ||
.Outputs | ||
JobIntervall object (see bConnect documentation for more details) | ||
#> | ||
|
||
[OutputType("System.Management.Automations.PSObject")] | ||
Param( | ||
[Parameter(Mandatory=$true)][ValidateSet("Weekdays","Every1stOfMonth","Every15thOfMonth","EveryXHours","EveryXDays","EveryXMinutes",ignoreCase=$true)][string]$IntervalType="Weekdays", | ||
[ValidateScript({ | ||
# This parameter must only be used with IntervalType=Weekdays | ||
if($IntervalType -in "Weekdays"){ | ||
$_.count -gt 0 | ||
} | ||
})] | ||
[ValidateSet("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday",ignoreCase=$true)][string[]]$Days, | ||
[ValidateScript({ | ||
# This parameter must only be used with IntervalType 'EveryXDays', 'EveryXHours' or 'EveryXMinutes' | ||
if($IntervalType -in "EveryXHours","EveryXDays","EveryXMinutes"){ | ||
$_ -is [int] | ||
} | ||
})] | ||
[int]$Multiplicator, | ||
[Parameter(Mandatory=$true)][ValidateLength(5,5)][ValidatePattern("\d{2}[:]\d{2}")][string]$StartTime, | ||
[int]$Repetitions = -1, | ||
[bool]$RescheduleOnError = $true | ||
) | ||
$time_seprtr = ":" | ||
$StartTime_ary = $StartTime.Split($time_seprtr) | ||
$_new_StartTime = @{ | ||
Hour = [int]$StartTime_ary[0]; | ||
Minute = [int]$StartTime_ary[1]; | ||
} | ||
|
||
$_new_JobIntervall = @{ | ||
StartTime = [PSCustomObject]$_new_StartTime; | ||
Repetitions = $Repetitions; | ||
RescheduleOnError = $RescheduleOnError; | ||
} | ||
|
||
if($IntervalType -in "EveryXHours","EveryXDays","EveryXMinutes"){ | ||
$FinalDays = @('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday') | ||
} | ||
elseif($IntervalType -in "Weekdays"){ | ||
$FinalDays = $Days | ||
} | ||
If(![string]::IsNullOrEmpty($IntervalType)) { | ||
$_new_JobIntervall += @{ IntervalType = $IntervalType } | ||
} | ||
If($FinalDays) { | ||
$_new_JobIntervall += @{ Days = $FinalDays } | ||
} | ||
|
||
If($Multiplicator) { | ||
$_new_JobIntervall += @{ Multiplicator = $Multiplicator } | ||
} | ||
|
||
return $_new_JobIntervall | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.