Merge acc2973fd9 into 4b6d3b8c5b
This commit is contained in:
commit
17c0c126e4
2 changed files with 196 additions and 197 deletions
|
|
@ -136,7 +136,7 @@ param(
|
||||||
[string]$Config
|
[string]$Config
|
||||||
)
|
)
|
||||||
|
|
||||||
######### FUNCTIONS #########
|
#region ######## FUNCTIONS #########
|
||||||
|
|
||||||
# Create Write-Log function
|
# Create Write-Log function
|
||||||
function Write-Log() {
|
function Write-Log() {
|
||||||
|
|
@ -438,10 +438,10 @@ function Get-DynamicDeadline() {
|
||||||
$UpdateID = Get-CMUpdate
|
$UpdateID = Get-CMUpdate
|
||||||
}
|
}
|
||||||
# Getting application information from WMI
|
# Getting application information from WMI
|
||||||
elseif ($RunApplicationIDEnabled -eq "True") {
|
elseif ($RunApplicationIDValue) {
|
||||||
Write-Log -Message "RunApplicationIDEnabled is True. Trying to get deadline information based on application id"
|
Write-Log -Message "RunApplicationIDEnabled is True. Trying to get deadline information based on application id"
|
||||||
try {
|
try {
|
||||||
$ApplicationID = Get-CimInstance -Namespace root\ccm\clientsdk -Query "SELECT * FROM CCM_Application where ID = '$DynDeadlineValue'"
|
$ApplicationID = Get-CimInstance -Namespace root\ccm\clientsdk -Query "SELECT * FROM CCM_Application where ID = '$RunApplicationIDValue'"
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Log -Level Error -Message "Failed to get Application ID from WMI"
|
Write-Log -Level Error -Message "Failed to get Application ID from WMI"
|
||||||
|
|
@ -614,21 +614,8 @@ function Write-PackageIDRegistry() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create Write-ApplicationIDRegistry function
|
# Create Test-ApplicationID function for checking, that App with given ID is deployed to the client
|
||||||
function Write-ApplicationIDRegistry() {
|
function Test-ApplicationID() {
|
||||||
Write-Log -Message "Running Write-ApplicationIDRegistry function"
|
|
||||||
$RegistryPath = "HKCU:\SOFTWARE\ToastNotificationScript"
|
|
||||||
$RegistryName = "RunApplicationID"
|
|
||||||
# Making sure that the registry path being used exists
|
|
||||||
if (-NOT(Test-Path -Path $RegistryPath)) {
|
|
||||||
try {
|
|
||||||
New-Item -Path $RegistryPath -Force
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Log -Level Error -Message "Error. Could not create ToastNotificationScript registry path"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# If the ApplicationID specified in the config.xml is picked up
|
|
||||||
if ($RunApplicationIDValue) {
|
if ($RunApplicationIDValue) {
|
||||||
# If the ConfigMgr service exist
|
# If the ConfigMgr service exist
|
||||||
if (Get-Service -Name ccmexec -ErrorAction SilentlyContinue) {
|
if (Get-Service -Name ccmexec -ErrorAction SilentlyContinue) {
|
||||||
|
|
@ -643,15 +630,6 @@ function Write-ApplicationIDRegistry() {
|
||||||
# If the ApplicationID is found in WMI with the ConfigMgr client, tattoo that ApplicationID into registry
|
# If the ApplicationID is found in WMI with the ConfigMgr client, tattoo that ApplicationID into registry
|
||||||
if ($TestApplicationID) {
|
if ($TestApplicationID) {
|
||||||
Write-Log -Message "ApplicationID: $RunApplicationIDValue was found in WMI as deployed to the client"
|
Write-Log -Message "ApplicationID: $RunApplicationIDValue was found in WMI as deployed to the client"
|
||||||
Write-Log -Message "Writing the ApplicationID to registry"
|
|
||||||
if ((Get-ItemProperty -Path $RegistryPath -Name $RegistryName -ErrorAction SilentlyContinue).$RegistryName -ne $RunApplicationIDValue) {
|
|
||||||
try {
|
|
||||||
New-ItemProperty -Path $RegistryPath -Name $RegistryName -Value $RunApplicationIDValue -PropertyType "String" -Force
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Log -Level Error -Message "Failed to write ApplicationID: $RunApplicationIDValue to registry"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Log -Level Error -Message "ApplicationID: $RunApplicationIDValue was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr"
|
Write-Log -Level Error -Message "ApplicationID: $RunApplicationIDValue was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr"
|
||||||
|
|
@ -788,7 +766,7 @@ function Write-CustomActionRegistry() {
|
||||||
New-Item "HKCU:\Software\Classes\$($ActionType)\shell\open\command" -Force -ErrorAction SilentlyContinue | Out-Null
|
New-Item "HKCU:\Software\Classes\$($ActionType)\shell\open\command" -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)" -Name 'URL Protocol' -Value '' -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)" -Name 'URL Protocol' -Value '' -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)" -Name '(default)' -Value "URL:$($ActionType) Protocol" -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)" -Name '(default)' -Value "URL:$($ActionType) Protocol" -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
$RegCommandValue = $RegCommandPath + '\' + "$($ActionType).cmd"
|
$RegCommandValue = $RegCommandPath + '\' + "$($ActionType).cmd %1"
|
||||||
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)\shell\open\command" -Name '(default)' -Value $RegCommandValue -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)\shell\open\command" -Name '(default)' -Value $RegCommandValue -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|
@ -833,7 +811,7 @@ function Write-CustomActionRegistry() {
|
||||||
New-Item "HKCU:\Software\Classes\$($ActionType)\shell\open\command" -Force -ErrorAction SilentlyContinue | Out-Null
|
New-Item "HKCU:\Software\Classes\$($ActionType)\shell\open\command" -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)" -Name 'URL Protocol' -Value '' -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)" -Name 'URL Protocol' -Value '' -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)" -Name '(default)' -Value "URL:$($ActionType) Protocol" -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)" -Name '(default)' -Value "URL:$($ActionType) Protocol" -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
$RegCommandValue = $RegCommandPath + '\' + "$($ActionType).cmd"
|
$RegCommandValue = $RegCommandPath + '\' + "$($ActionType).cmd %1"
|
||||||
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)\shell\open\command" -Name '(default)' -Value $RegCommandValue -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
New-ItemProperty -LiteralPath "HKCU:\Software\Classes\$($ActionType)\shell\open\command" -Name '(default)' -Value $RegCommandValue -PropertyType String -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|
@ -1050,7 +1028,7 @@ exit 0
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$GetCustomScriptPath = $PathInfo.FullName
|
$GetCustomScriptPath = $PathInfo.FullName
|
||||||
[String]$Script = "powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File `"$global:CustomScriptsPath\ToastRunApplicationID.ps1`""
|
[String]$Script = "powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File `"$global:CustomScriptsPath\ToastRunApplicationID.ps1`" %1"
|
||||||
if (-NOT[string]::IsNullOrEmpty($Script)) {
|
if (-NOT[string]::IsNullOrEmpty($Script)) {
|
||||||
Out-File -FilePath $GetCustomScriptPath -InputObject $Script -Encoding ASCII -Force
|
Out-File -FilePath $GetCustomScriptPath -InputObject $Script -Encoding ASCII -Force
|
||||||
}
|
}
|
||||||
|
|
@ -1080,19 +1058,25 @@ exit 0
|
||||||
try {
|
try {
|
||||||
$GetCustomScriptPath = $PathInfo.FullName
|
$GetCustomScriptPath = $PathInfo.FullName
|
||||||
[String]$Script = @'
|
[String]$Script = @'
|
||||||
$RegistryPath = "HKCU:\SOFTWARE\ToastNotificationScript"
|
$ApplicationID = $args[0]
|
||||||
$ApplicationID = (Get-ItemProperty -Path $RegistryPath -Name "RunApplicationID").RunApplicationID
|
if (!$ApplicationID) { throw "ApplicationID wasn't specified" }
|
||||||
$TestApplicationID = Get-CimInstance -ClassName CCM_Application -Namespace ROOT\ccm\ClientSDK | Where-Object {$_.Id -eq $ApplicationID}
|
$ApplicationID = ($ApplicationID -replace '^[^:]*:').trim()
|
||||||
|
if ($ApplicationID -notmatch "^ScopeId_.+/Application_.+") { throw "ApplicationID ($ApplicationID) isn't in correct format (regex `"^ScopeId_.+/Application_.+`"" }
|
||||||
|
|
||||||
|
$TestApplicationID = Get-CimInstance -ClassName CCM_Application -Namespace ROOT\ccm\ClientSDK | Where-Object { $_.Id -eq $ApplicationID }
|
||||||
|
|
||||||
$AppArguments = @{
|
$AppArguments = @{
|
||||||
Id = $TestApplicationID.Id
|
Id = $TestApplicationID.Id
|
||||||
IsMachineTarget = $TestApplicationID.IsMachineTarget
|
IsMachineTarget = $TestApplicationID.IsMachineTarget
|
||||||
Revision = $TestApplicationID.Revision
|
Revision = $TestApplicationID.Revision
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-NOT[string]::IsNullOrEmpty($TestApplicationID)) {
|
if (-NOT[string]::IsNullOrEmpty($TestApplicationID)) {
|
||||||
if ($TestApplicationID.InstallState -eq "NotInstalled") { Invoke-CimMethod -Namespace "ROOT\ccm\clientSDK" -ClassName CCM_Application -MethodName Install -Arguments $AppArguments }
|
if ($TestApplicationID.InstallState -eq "NotInstalled") { Invoke-CimMethod -Namespace "ROOT\ccm\clientSDK" -ClassName CCM_Application -MethodName Install -Arguments $AppArguments }
|
||||||
elseif ($TestApplicationID.InstallState -eq "Installed") { Invoke-CimMethod -Namespace "ROOT\ccm\clientSDK" -ClassName CCM_Application -MethodName Repair -Arguments $AppArguments }
|
elseif ($TestApplicationID.InstallState -eq "Installed") { Invoke-CimMethod -Namespace "ROOT\ccm\clientSDK" -ClassName CCM_Application -MethodName Repair -Arguments $AppArguments }
|
||||||
if (Test-Path -Path "$env:windir\CCM\ClientUX\SCClient.exe") { Start-Process -FilePath "$env:windir\CCM\ClientUX\SCClient.exe" -ArgumentList "SoftwareCenter:Page=InstallationStatus" -WindowStyle Maximized }
|
if (Test-Path -Path "$env:windir\CCM\ClientUX\SCClient.exe") { Start-Process -FilePath "$env:windir\CCM\ClientUX\SCClient.exe" -ArgumentList "SoftwareCenter:Page=InstallationStatus" -WindowStyle Maximized }
|
||||||
}
|
}
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
'@
|
'@
|
||||||
if (-NOT[string]::IsNullOrEmpty($Script)) {
|
if (-NOT[string]::IsNullOrEmpty($Script)) {
|
||||||
|
|
@ -1116,7 +1100,9 @@ exit 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
######### GENERAL VARIABLES #########
|
#endregion ######## FUNCTIONS #########
|
||||||
|
|
||||||
|
#region ######## GENERAL VARIABLES #########
|
||||||
# Global variables
|
# Global variables
|
||||||
# Setting global script version
|
# Setting global script version
|
||||||
$global:ScriptVersion = "2.1.0"
|
$global:ScriptVersion = "2.1.0"
|
||||||
|
|
@ -1274,8 +1260,6 @@ if(-NOT[string]::IsNullOrEmpty($Xml)) {
|
||||||
$CreateScriptsProtocolsEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'CreateScriptsAndProtocols'} | Select-Object -ExpandProperty 'Enabled'
|
$CreateScriptsProtocolsEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'CreateScriptsAndProtocols'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
$RunPackageIDEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'RunPackageID'} | Select-Object -ExpandProperty 'Enabled'
|
$RunPackageIDEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'RunPackageID'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
$RunPackageIDValue = $Xml.Configuration.Option | Where-Object {$_.Name -like 'RunPackageID'} | Select-Object -ExpandProperty 'Value'
|
$RunPackageIDValue = $Xml.Configuration.Option | Where-Object {$_.Name -like 'RunPackageID'} | Select-Object -ExpandProperty 'Value'
|
||||||
$RunApplicationIDEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'RunApplicationID'} | Select-Object -ExpandProperty 'Enabled'
|
|
||||||
$RunApplicationIDValue = $Xml.Configuration.Option | Where-Object {$_.Name -like 'RunApplicationID'} | Select-Object -ExpandProperty 'Value'
|
|
||||||
# ConfigMgr Software Updates
|
# ConfigMgr Software Updates
|
||||||
# Added in version 2.0.0
|
# Added in version 2.0.0
|
||||||
$RunUpdateIDEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'RunUpdateID'} | Select-Object -ExpandProperty 'Enabled'
|
$RunUpdateIDEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'RunUpdateID'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
|
|
@ -1359,6 +1343,38 @@ if(-NOT[string]::IsNullOrEmpty($Xml)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion ####### GENERAL VARIABLES #########
|
||||||
|
|
||||||
|
#region ####### CHECKS #########
|
||||||
|
|
||||||
|
if ($ActionButton1Content -match "^ToastRunApplicationID:\s*$") {
|
||||||
|
Write-Log -Level Error -Message "Error. Incomplete Value in the $Config file Action1 tag"
|
||||||
|
Write-Log -Level Error -Message "Error. You have to specify also the Application share link in format: ToastRunApplicationID:ScopeId_XXX/Application_YYY"
|
||||||
|
Write-Log -Level Error -Message "Error. Application Share link can be found in Software Center by clicking on share icon on top right of the screen"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
if ($ActionButton2Content -match "^ToastRunApplicationID:\s*$") {
|
||||||
|
Write-Log -Level Error -Message "Error. Incomplete Value in the $Config file Action2 tag"
|
||||||
|
Write-Log -Level Error -Message "Error. You have to specify also the Application share link in format: ToastRunApplicationID:ScopeId_XXX/Application_YYY"
|
||||||
|
Write-Log -Level Error -Message "Error. Application Share link can be found in Software Center by clicking on share icon on top right of the screen"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
# Check if given Application ID is valid
|
||||||
|
if ($ActionButton1Content -match "^ToastRunApplicationID:ScopeId_.+/Application_.+") {
|
||||||
|
$RunApplicationIDValue = ($ActionButton1Content -replace '^[^:]*:').trim()
|
||||||
|
Test-ApplicationID
|
||||||
|
}
|
||||||
|
if ($ActionButton2Content -match "^ToastRunApplicationID:ScopeId_.+/Application_.+") {
|
||||||
|
$RunApplicationIDValue = ($ActionButton2Content -replace '^[^:]*:').trim()
|
||||||
|
Test-ApplicationID
|
||||||
|
}
|
||||||
|
# because of dynamic deadline retrieval I allow just one installation
|
||||||
|
if ($ActionButton2Content -match "^ToastRunApplicationID:" -and $RunApplicationIDValue) {
|
||||||
|
Write-Log -Level Error -Message "Error. Multiple Application installations defined in the $Config file through the Action tags"
|
||||||
|
Write-Log -Level Error -Message "Error. Only one application can be installed, so modify one of Action options"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Check if toast is enabled in config.xml
|
# Check if toast is enabled in config.xml
|
||||||
if ($ToastEnabled -ne "True") {
|
if ($ToastEnabled -ne "True") {
|
||||||
Write-Log -Message "Toast notification is not enabled. Please check $Config file"
|
Write-Log -Message "Toast notification is not enabled. Please check $Config file"
|
||||||
|
|
@ -1456,18 +1472,6 @@ if (($DeadlineEnabled -eq "True") -AND ($DynDeadlineEnabled -eq "True")) {
|
||||||
Write-Log -Level Error -Message "You should only enable one of the deadline options. Check your config"
|
Write-Log -Level Error -Message "You should only enable one of the deadline options. Check your config"
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
if (($RunApplicationIDEnabled -eq "True") -AND ($RunPackageIDEnabled -eq "True")) {
|
|
||||||
Write-Log -Level Error -Message "Error. Conflicting selection in the $Config file"
|
|
||||||
Write-Log -Level Error -Message "Error. You can't have RunApplicationIDEnabled set to True and RunPackageIDEnabled set to True at the same time"
|
|
||||||
Write-Log -Level Error -Message "You should only enable one of the options. Check your config"
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
if (($RunApplicationIDEnabled -eq "True") -AND ($RunUpdateIDEnabled -eq "True")) {
|
|
||||||
Write-Log -Level Error -Message "Error. Conflicting selection in the $Config file"
|
|
||||||
Write-Log -Level Error -Message "Error. You can't have RunApplicationIDEnabled set to True and RunUpdateIDEnabled set to True at the same time"
|
|
||||||
Write-Log -Level Error -Message "You should only enable one of the options. Check your config"
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
if (($RunUpdateIDEnabled -eq "True") -AND ($RunPackageIDEnabled -eq "True")) {
|
if (($RunUpdateIDEnabled -eq "True") -AND ($RunPackageIDEnabled -eq "True")) {
|
||||||
Write-Log -Level Error -Message "Error. Conflicting selection in the $Config file"
|
Write-Log -Level Error -Message "Error. Conflicting selection in the $Config file"
|
||||||
Write-Log -Level Error -Message "Error. You can't have RunUpdateIDEnabled set to True and RunPackageIDEnabled set to True at the same time"
|
Write-Log -Level Error -Message "Error. You can't have RunUpdateIDEnabled set to True and RunPackageIDEnabled set to True at the same time"
|
||||||
|
|
@ -1513,24 +1517,6 @@ if (($Action -eq "ToastReboot:") -AND ($RunPackageIDEnabled -eq "True")) {
|
||||||
Write-Log -Level Error -Message "This seems like an unintended configuration. Check your config"
|
Write-Log -Level Error -Message "This seems like an unintended configuration. Check your config"
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
if (($Action -eq "ToastRunPackageID:") -AND ($RunApplicationIDEnabled -eq "True")) {
|
|
||||||
Write-Log -Level Error -Message "Error. Conflicting selection in the $Config file"
|
|
||||||
Write-Log -Level Error -Message "You are using the toast notification with RunApplicationIDEnabled set to $RunApplicationIDEnabled, but the action button is set to $Action"
|
|
||||||
Write-Log -Level Error -Message "This seems like an unintended configuration. Check your config"
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
if (($Action -eq "ToastRunUpdateID:") -AND ($RunApplicationIDEnabled -eq "True")) {
|
|
||||||
Write-Log -Level Error -Message "Error. Conflicting selection in the $Config file"
|
|
||||||
Write-Log -Level Error -Message "You are using the toast notification with RunApplicationIDEnabled set to $RunApplicationIDEnabled, but the action button is set to $Action"
|
|
||||||
Write-Log -Level Error -Message "This seems like an unintended configuration. Check your config"
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
if (($Action -eq "ToastReboot:") -AND ($RunApplicationIDEnabled -eq "True")) {
|
|
||||||
Write-Log -Level Error -Message "Error. Conflicting selection in the $Config file"
|
|
||||||
Write-Log -Level Error -Message "You are using the toast notification with RunApplicationIDEnabled set to $RunApplicationIDEnabled, but the action button is set to $Action"
|
|
||||||
Write-Log -Level Error -Message "This seems like an unintended configuration. Check your config"
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
# New checks for conflicting selections. Trying to prevent combinations which will make the toast render without buttons
|
# New checks for conflicting selections. Trying to prevent combinations which will make the toast render without buttons
|
||||||
# Added in version 2.1.0
|
# Added in version 2.1.0
|
||||||
if (($ActionButton1Enabled -ne "True") -AND ($ActionButton2Enabled -eq "True")){
|
if (($ActionButton1Enabled -ne "True") -AND ($ActionButton2Enabled -eq "True")){
|
||||||
|
|
@ -1563,6 +1549,21 @@ if (($SnoozeButtonEnabled -eq "True") -AND ($ADPasswordExpirationTextEnabled -eq
|
||||||
Write-Log -Level Error -Message "That will result in too much text and the toast notification will render without buttons. Check your config"
|
Write-Log -Level Error -Message "That will result in too much text and the toast notification will render without buttons. Check your config"
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
# New checks for value format
|
||||||
|
if ($Action1 -match "ToastRunApplicationID:" -and (($Action1.trim() -match " ") -or $Action1 -notmatch "ToastRunApplicationID:ScopeId_.+/Application_.+")) {
|
||||||
|
Write-Log -Level Error -Message "Value of Action1 XML config tag isn't in correct format"
|
||||||
|
Write-Log -Level Error -Message "It should be like: ToastRunApplicationID:ScopeId_5197DD71-3116-4878-A26C-EA6155A28E9B/Application_31e422a6-3905-4f83-b9aa-cf1635648e72"
|
||||||
|
Write-Log -Level Error -Message "Value can be found in Software Center by clicking on share icon of application to install"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
if ($Action2 -match "ToastRunApplicationID:" -and (($Action2.trim() -match " ") -or $Action2 -notmatch "ToastRunApplicationID:ScopeId_.+/Application_.+")) {
|
||||||
|
Write-Log -Level Error -Message "Value of Action2 XML config tag isn't in correct format"
|
||||||
|
Write-Log -Level Error -Message "It should be like: ToastRunApplicationID:ScopeId_5197DD71-3116-4878-A26C-EA6155A28E9B/Application_31e422a6-3905-4f83-b9aa-cf1635648e72"
|
||||||
|
Write-Log -Level Error -Message "Value can be found in Software Center by clicking on share icon of application to install"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion ######## CHECKS #########
|
||||||
|
|
||||||
# Downloading images into user's temp folder if images are hosted online
|
# Downloading images into user's temp folder if images are hosted online
|
||||||
if (($LogoImageFileName.StartsWith("https://")) -OR ($LogoImageFileName.StartsWith("http://"))) {
|
if (($LogoImageFileName.StartsWith("https://")) -OR ($LogoImageFileName.StartsWith("http://"))) {
|
||||||
|
|
@ -1649,9 +1650,8 @@ if ($RunUpdateIDEnabled -eq "True") {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Running RunApplicationID function
|
# Running RunApplicationID function
|
||||||
if ($RunApplicationIDEnabled -eq "True") {
|
if ($RunApplicationIDValue) {
|
||||||
Write-Log -Message "RunApplicationID set to True. Will allow execution of ApplicationID directly from the toast action button"
|
Write-Log -Message "RunApplicationID set to True. Will allow execution of ApplicationID directly from the toast action button"
|
||||||
Write-ApplicationIDRegistry
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Running RunPackageID function
|
# Running RunPackageID function
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
<Option Name="ADPasswordExpirationText" Enabled="False" /> <!-- Adds an additional group to the toast with text -->
|
<Option Name="ADPasswordExpirationText" Enabled="False" /> <!-- Adds an additional group to the toast with text -->
|
||||||
<Option Name="ADPasswordExpirationDays" Value="90" /> <!-- How many days in advance shall the toast start reminding the users -->
|
<Option Name="ADPasswordExpirationDays" Value="90" /> <!-- How many days in advance shall the toast start reminding the users -->
|
||||||
<Option Name="RunPackageID" Enabled="False" Value="KR100907" /> <!-- Will enable the toast to run any ConfigMgr PackageID through a custom protocol -->
|
<Option Name="RunPackageID" Enabled="False" Value="KR100907" /> <!-- Will enable the toast to run any ConfigMgr PackageID through a custom protocol -->
|
||||||
<Option Name="RunApplicationID" Enabled="False" Value="ScopeId_A9117680-D054-482B-BC97-532E6CBD0E6B/Application_fd55f35c-4e34-4490-a3ec-ee0b79233ec6" /> <!-- Will enable the toast to run any ConfigMgr ApplicationID through a custom protocol -->
|
|
||||||
<Option Name="RunUpdateID" Enabled="False" Value="4561600" /> <!-- Will enable the toast to run any ConfigMgr Update ID through a custom protocol. Configure the value to the relevant KB-article ID -->
|
<Option Name="RunUpdateID" Enabled="False" Value="4561600" /> <!-- Will enable the toast to run any ConfigMgr Update ID through a custom protocol. Configure the value to the relevant KB-article ID -->
|
||||||
<Option Name="RunUpdateTitle" Enabled="False" Value="" /> <!-- Will enable the toast to run any ConfigMgr Update Name through a custom protocol -->
|
<Option Name="RunUpdateTitle" Enabled="False" Value="" /> <!-- Will enable the toast to run any ConfigMgr Update Name through a custom protocol -->
|
||||||
<Option Name="Deadline" Enabled="False" Value="30-09-2019 08:00" /> <!-- Adds an additional group to the toast with text about the deadline of the OSUpgrade -->
|
<Option Name="Deadline" Enabled="False" Value="30-09-2019 08:00" /> <!-- Adds an additional group to the toast with text about the deadline of the OSUpgrade -->
|
||||||
|
|
@ -28,7 +27,7 @@
|
||||||
<Option Name="DismissButton" Enabled="False" /> <!-- Enables or disables the dismiss button. -->
|
<Option Name="DismissButton" Enabled="False" /> <!-- Enables or disables the dismiss button. -->
|
||||||
<Option Name="SnoozeButton" Enabled="False" /> <!-- Enabling this option will always enable action button and dismiss button -->
|
<Option Name="SnoozeButton" Enabled="False" /> <!-- Enabling this option will always enable action button and dismiss button -->
|
||||||
<Option Name="Scenario" Type="alarm" /> <!-- Possible values are: reminder | short | long -->
|
<Option Name="Scenario" Type="alarm" /> <!-- Possible values are: reminder | short | long -->
|
||||||
<Option Name="Action1" Value="ToastReboot:" /> <!-- Action taken when using the Action button. Can be any protocol in Windows -->
|
<Option Name="Action1" Value="ToastRunApplicationID:ScopeId_5197DD71-3116-4878-A26C-EA6155A28E9B/Application_91b60d2e-720e-46b4-8da9-5b56f9ff0177" /> <!-- Action taken when using the Action button. Can be any protocol in Windows -->
|
||||||
<Option Name="Action2" Value="https://imab.dk" /> <!-- Action taken when using the Action button. Can be any protocol in Windows -->
|
<Option Name="Action2" Value="https://imab.dk" /> <!-- Action taken when using the Action button. Can be any protocol in Windows -->
|
||||||
<Text Option="GreetGivenName" Enabled="True" /> <!-- Displays the toast with a personal greeting using the users given name retrieved from AD. Will try retrieval from WMI of no local AD -->
|
<Text Option="GreetGivenName" Enabled="True" /> <!-- Displays the toast with a personal greeting using the users given name retrieved from AD. Will try retrieval from WMI of no local AD -->
|
||||||
<Text Option="MultiLanguageSupport" Enabled="False" /> <!-- Enable support for multiple languages. If set to True, the toast notification will look for the users language culture within the config file -->
|
<Text Option="MultiLanguageSupport" Enabled="False" /> <!-- Enable support for multiple languages. If set to True, the toast notification will look for the users language culture within the config file -->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue