Good morning. I have assumed responsibility for MDT at my workplace and so far things have been smooth. I updated to the latest Windows 11 21h2 in our test environment and now I am having a problem with a script to reset the LAPS password of a device. This issue does not happen on the old version of Windows 11, and unfortunately I don't know what version it is outside of 21h1. We are using a Powershell script which imports the modules Invoke-CommandAs and AdmPwd.PS. Picture of the error is attached.
When the script functions correctly, it just runs and quits the window. The problem is that there is now a security warning and it requires input from the user.
On MDT, the quiet install command is: powershell -ExecutionPolicy Bypass -file .\install.ps1
Note that this works perfectly on an older version of Windows 11, but on the 21h2 October version, it does not.
The script install.ps1:
Import-Module "$PSScriptRoot\Invoke-CommandAs\Invoke-CommandAs.psd1"
Import-Module AdmPwd.PS
Invoke-CommandAs -AsSystem -ScriptBlock {
Reset-AdmPwdPassword -ComputerName $env:COMPUTERNAME -WhenEffective (Get-Date).AddDays(-1)
}
I have tried including Unblock-File in this script, before Import-Module, and tunneling it to the source directory of Invoke-CommandAs, and it hasn't helped. I am still learning how to write and interpret powershell, so I am pretty stumped on how to fix this problem. If there is any information that I left out I am sorry. The server which hosts our deployment shares has an execution policy of RemoteSigned. I have also found the source files of these scripts in our file repository and unblocked them all through Properties. Thanks in advance for any help you can provide me in getting this process back up and running. 