-
Notifications
You must be signed in to change notification settings - Fork 541
Closed
Labels
Status: Needs TriageNeeds to be labelled and assigned for reviewNeeds to be labelled and assigned for reviewType: Issue / BugSomething isn't working as expectedSomething isn't working as expected
Description
Prerequisites
- Ensure you write a short, descriptive title after [Bug] above.
- Make sure to search for any existing issues before filing a new one.
- Verify you are able to reproduce the issue with the latest released version
PSAppDeployToolkit version
4.0.4
Describe the bug
When running invoke-AppDeployToolkit.exe in an environment that has Powershell constrained language mode enabled (in my case due to WDAC being enabled) , we run into a dot sourcing error.
According to the logs, invoke-AppDeployToolkit.exe adds some parameters to the invoke-AppDeployToolkit.ps1 automatically and that's where the issue lies.
in the logfile snippet we can see the following :
Commencing invocation of C:\WINDOWS\ccmcache\7\Invoke-AppDeployToolkit.ps1.
Administrator rights are required. The verb 'RunAs' will be used with the invocation.
No '-File' parameter specified on command-line. Adding parameter '-File "C:\WINDOWS\ccmcache\7\Invoke-AppDeployToolkit.ps1"'...
Using the -file parameter while having a [cmdletbinding] section, the launch method uses dot sourcing and this is being blocked by WDAC.
Unfortunately this is not truly visible in any of the eventlogs but enabling powershell transcript logging does show you the actual error :
PS>C:\WINDOWS\ccmcache\7\Invoke-AppDeployToolkit.ps1
Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator.
C:\WINDOWS\ccmcache\7\Invoke-AppDeployToolkit.ps1 : Cannot dot-source this command because it was defined in a
different language mode. To invoke this command without importing its contents, omit the '.' operator.
+ CategoryInfo : InvalidOperation: (:) [Invoke-AppDeployToolkit.ps1], NotSupportedException
+ FullyQualifiedErrorId : DotSourceNotSupported,Invoke-AppDeployToolkit.ps1
A quick fix could be by removing the -File parameter.
Steps to reproduce
- Enable Powershell Constrained language mode
- Install a PSADTv4 package using Invoke-AppDeployToolkit.exe without any additional parameters.
Environment data
OsName : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsProductName : Windows 10 Enterprise
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US}
KeyboardLayout : 00020409
TimeZone : (UTC+01:00) Brussels, Copenhagen, Madrid, Paris
HyperVisorPresent : True
CsPartOfDomain : True
CsPCSystemType : Desktop
Metadata
Metadata
Assignees
Labels
Status: Needs TriageNeeds to be labelled and assigned for reviewNeeds to be labelled and assigned for reviewType: Issue / BugSomething isn't working as expectedSomething isn't working as expected