mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-06-16 19:03:46 +00:00
fixed shell launcher powershell script
This commit is contained in:
@ -78,7 +78,7 @@ $shellLauncherConfiguration = @"
|
|||||||
$namespaceName="root\cimv2\mdm\dmmap"
|
$namespaceName="root\cimv2\mdm\dmmap"
|
||||||
$className="MDM_AssignedAccess"
|
$className="MDM_AssignedAccess"
|
||||||
$obj = Get-CimInstance -Namespace $namespaceName -ClassName $className
|
$obj = Get-CimInstance -Namespace $namespaceName -ClassName $className
|
||||||
$obj.Configuration = [System.Net.WebUtility]::HtmlEncode($shellLauncherConfiguration)
|
$obj.ShellLauncher = [System.Net.WebUtility]::HtmlEncode($shellLauncherConfiguration)
|
||||||
$obj = Set-CimInstance -CimInstance $obj -ErrorVariable cimSetError -ErrorAction SilentlyContinue
|
$obj = Set-CimInstance -CimInstance $obj -ErrorVariable cimSetError -ErrorAction SilentlyContinue
|
||||||
if($cimSetError) {
|
if($cimSetError) {
|
||||||
Write-Output "An ERROR occurred. Displaying error record and attempting to retrieve error logs...`n"
|
Write-Output "An ERROR occurred. Displaying error record and attempting to retrieve error logs...`n"
|
||||||
@ -86,6 +86,7 @@ if($cimSetError) {
|
|||||||
|
|
||||||
$timeout = New-TimeSpan -Seconds 30
|
$timeout = New-TimeSpan -Seconds 30
|
||||||
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
|
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
|
||||||
|
$eventLogFilterHashTable = @{ LogName='Microsoft-Windows-AssignedAccess/Admin' }
|
||||||
do{
|
do{
|
||||||
$events = Get-WinEvent -FilterHashtable $eventLogFilterHashTable -ErrorAction Ignore
|
$events = Get-WinEvent -FilterHashtable $eventLogFilterHashTable -ErrorAction Ignore
|
||||||
} until ($events.Count -or $stopwatch.Elapsed -gt $timeout) # wait for the log to be available
|
} until ($events.Count -or $stopwatch.Elapsed -gt $timeout) # wait for the log to be available
|
||||||
|
Reference in New Issue
Block a user