Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show-BalloonTip error at 3.9.0 #733

Closed
cyborgrd opened this issue Jan 11, 2023 · 13 comments
Closed

Show-BalloonTip error at 3.9.0 #733

cyborgrd opened this issue Jan 11, 2023 · 13 comments

Comments

@cyborgrd
Copy link

I get access denied at $notifier.Show($toastXml)

[Pre-Installation] :: Error Record:

Message : Ausnahme beim Aufrufen von "Show" mit 1 Argument(en): "Zugriff verweigert (Ausnahme von HRESULT:
0x80070005 (E_ACCESSDENIED))"
InnerException : System.UnauthorizedAccessException: Zugriff verweigert (Ausnahme von HRESULT: 0x80070005
(E_ACCESSDENIED))
bei Windows.UI.Notifications.ToastNotifier.Show(ToastNotification notification)
bei CallSite.Target(Closure , CallSite , Object , Object )

FullyQualifiedErrorId : UnauthorizedAccessException
ScriptStackTrace : bei Show-BalloonTip, C:\Temp\AppDeployToolkit\AppDeployToolkitMain.ps1: Zeile 10606
bei Show-InstallationProgress, C:\Temp\AppDeployToolkit\AppDeployToolkitMain.ps1:
Zeile 10727
bei , C:\Temp\Adobe_Acrobat_20.005.30381_x86.ps1: Zeile 245
bei , : Zeile 1
bei , : Zeile 1

PositionMessage : In C:\Temp\AppDeployToolkit*AppDeployToolkitMain.ps1:10606 Zeichen:13*
+ $notifier.Show($toastXml)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~

Error Inner Exception(s):

Message : Zugriff verweigert (Ausnahme von HRESULT: 0x80070005 (E_ACCESSDENIED))
InnerException :

image

I run it with admin rights

@Wraith4260
Copy link

Wraith4260 commented Jan 11, 2023

Seconded, I am also get this error. It worked fine for me under my own local user context (has admin privileges), but when I launch if via PSEXEC (-s -i) as NT AUTHORITY\SYSTEM I get the error @cyborgrd references above.

English
2023-01-11 11_37_36-Clipboard

@cyborgrd
Copy link
Author

Yes, the issue appears with system and admin rights user (different) from logged on user

@petedoc1972
Copy link

Same issue here, issue appears when toast is attempted (with eith run as (different user admin) or as system:
[Pre-Installation] :: Error Record:

Message : Exception calling "Show" with "1" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))"
InnerException : System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))
at Windows.UI.Notifications.ToastNotifier.Show(ToastNotification notification)
at CallSite.Target(Closure , CallSite , Object , Object )

FullyQualifiedErrorId : UnauthorizedAccessException
ScriptStackTrace : at Show-BalloonTip, C:\PS200 Settings IMS\AppDeployToolkit\AppDeployToolkitMain.ps1:
line 10566

@PowershellBacon
Copy link

PowershellBacon commented Jan 11, 2023

Same issue here, running under interactive system account from psexec, which we normally would use for SCCM installs, this is what I get when i defer
image

This is what I get when I continue
image

@ekpat
Copy link

ekpat commented Jan 12, 2023

Same here:
2023-01-12_11h17_25

@JFPCreations
Copy link

Same here when using ServiceUI.exe to see the popup without admin right in system mode installation. This worked well with 3.8.4.
RemoteDesktopManagerFree_ekNM9J6m8v

@JuryA
Copy link

JuryA commented Jan 12, 2023

I have the same problem:

image

@DanGough
Copy link
Contributor

Does the issue go away if you disable balloon tips in the XML config?

I always do this to my template to avoid doubling up on the popups since Intune creates its own already.

@ekpat
Copy link

ekpat commented Jan 13, 2023

Does the issue go away if you disable balloon tips in the XML config?

I always do this to my template to avoid doubling up on the popups since Intune creates its own already.

Yes, it does.

<ShowBalloonNotifications>False</ShowBalloonNotifications>

@rvkasper
Copy link
Contributor

Was looking at pulling a pull request together to move this to Execute-ProcessAsUser if the processuser <> logged in user:
If ($RunAsActiveUser -and ($RunAsActiveUser.SID -ine $CurrentProcessSID.Value)) { Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -Command & {$notifyToastScriptBlock} '$BalloonTipText' '$BalloonTipTitle' '$appDeployLogoImage'" -RunLevel LeastPrivilege } Else { &$notifyToastScriptBlock '$BalloonTipText' '$BalloonTipTitle' '$appDeployLogoImage' }

Moving the XML and other Toast-specific items into a ScriptBlock... but can never seem to get the blue PowerShell window to not pop! I will keep hammering on it but wanted to at least post some breadcrumbs here

@equillibrium
Copy link

Also I'd like to add up to the issue to not create another one: for some reason when I run "empty" deployapplication.ps1 (without any installation files) the balloon tooltips run okay, when i run it with installation files the balloon tooltip doesn't show any info, just "windows powershell new notification", like it can't show the actual text (installation begin... etc) for some reason

@hunterp12
Copy link

What has worked for me until they fix it how they want. I just edited it to act sort of like the balloon tips and to either Invoke if running without Admin or Execute-ProcessAsUser. Be sure to fix the other bug under Execute-ProcessAsUser around line 7498 by adding

$EscapedPath = $Path
$EscapedParameters = $Parameters

just under

            [String[]]$executeProcessAsUserScript = "strCommand = $executeProcessAsUserParametersVBS"
            $executeProcessAsUserScript += 'set oWShell = CreateObject("WScript.Shell")'
            $executeProcessAsUserScript += 'intReturn = oWShell.Run(strCommand, 0, true)'
            $executeProcessAsUserScript += 'WScript.Quit intReturn'
            $executeProcessAsUserScript | Out-File -FilePath "$executeAsUserTempPath\$($schTaskName).vbs" -Force -Encoding 'Default' -ErrorAction 'SilentlyContinue'
            $Path = "$envWinDir\System32\wscript.exe"
            $Parameters = "`"$executeAsUserTempPath\$($schTaskName).vbs`""

Then this is the fix under the Else statement in Show-BalloonTip for the toast section around line 10541. Hope it helps.

{
          Write-Log -Message "Displaying toast notification with message [$BalloonTipText]." -Source ${CmdletName}

           [scriptblock]$toastScriptBlock  = {
           Param(
                       [Parameter(Mandatory = $true, Position = 0)]
                       [ValidateNotNullOrEmpty()]
                       [String]$BalloonTipText,
                       [Parameter(Mandatory = $false, Position = 1)]
                       [ValidateNotNullorEmpty()]
                       [String]$BalloonTipTitle,
                       [Parameter(Mandatory = $false, Position = 2)]
                       [ValidateNotNullorEmpty()]
                       [String]$AppDeployLogoImage
                   )
           $toastAppId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
           [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
           [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null

           ## Gets the Template XML so we can manipulate the values
           $Template = [Windows.UI.Notifications.ToastTemplateType]::ToastImageAndText01
           [xml] $ToastTemplate = ([Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($Template).GetXml())
           [xml] $ToastTemplate = @"
<toast launch="app-defined-string">
   <visual>
   	<binding template="ToastImageAndText02">
   		<text id="1">$BalloonTipTitle</text>
   		<text id="2">$BalloonTipText</text>
   		<image id="1" src="file://$appDeployLogoImage" />
   	</binding>
   </visual>
</toast>
"@

           $ToastXml = New-Object -TypeName Windows.Data.Xml.Dom.XmlDocument
           $ToastXml.LoadXml($ToastTemplate.OuterXml)


           $notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($toastAppId)
           $notifier.Show($toastXml)
           }

           If ( -not $IsAdmin) {
           
           Invoke-Command -ScriptBlock $toastScriptBlock -ArgumentList $BalloonTipText, $BalloonTipTitle, $AppDeployLogoImage

           } Else {
           
           Set-Content "C:\Windows\Temp\PSADTToast.ps1" -Value $toastScriptBlock -Force
           $path = "C:\Windows\Temp\PSADTToast.ps1"
           Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-Command & { & `"C:\Windows\Temp\PSADTToast.ps1 `'$BalloonTipText`' `'$BalloonTipTitle`' `'$AppDeployLogoImage`'`"; Exit `$LastExitCode }" -Wait
           Remove-Item $path -Force
           
           }
           
           sleep -Seconds 5

       }

@seanlillis
Copy link
Member

seanlillis commented Jan 19, 2023

Thanks for sharing the fix, I have pushed a commit with a modified version of this for the next release v3.9.1.

seanlillis added a commit that referenced this issue Jan 19, 2023
…uld not display when run in the system context (#733)

- Resolved an issue introduced in v3.9.0 where toast notifications would not display when run in the system context (#733)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests