Forum Discussion
Windows 11 assigned access - setting kiosk mode over powershell and WMI
Hey, so I ran the script over a powershell terminal that was started with psexec.exe -i -s cmd.exe
unfortunately It ran on line 44 into an error again, as the screenshot shows
- MichaelWAug 11, 2023Brass Contributor
Also tried it with powershell 7 and with another version of the script (also from an elevated cmd started with psexec)
$nameSpaceName = "root\cimv2\mdm\dmmap" $className = "MDM_AssignedAccess" # Schreiben Sie die XML-Konfiguration in eine Datei $xmlContent = @" <?xml version="1.0" encoding="utf-8"?> <AssignedAccessConfiguration xmlns="http://schemas.microsoft.com/AssignedAccess/2017/config" xmlns:win11="http://schemas.microsoft.com/AssignedAccess/2022/config"> <!-- ... Ihre XML-Konfiguration hier ... --> </AssignedAccessConfiguration> "@ $xmlFilePath = "win11-kiosk-wmi.xml" $xmlContent | Set-Content -Path $xmlFilePath -Encoding UTF8 # Get-CimInstance, um die Instanz zu erhalten $obj = Get-CimInstance -Namespace $nameSpaceName -ClassName $className # Setzen Sie die Konfigurationseigenschaft des $obj-Objekts $obj.Configuration = $xmlFilePath # Aktualisieren Sie die Instanz mit der neuen Konfiguration Set-CimInstance -CimInstance $obj
but also getting an error
- MichaelWAug 11, 2023Brass Contributor
also ran the command on the client to test if I can access this class
- LainRobertsonAug 11, 2023Silver Contributor
Hi, Michael.
Again, I have to apologies for needing to use a translator (where I hope the translation is accurate), which for the error of:
Es ist ein allgemeiner fehler aufgetreten, fur den kein spezifischerer fehlercode verfugbar ist
I got a translation of:
A general error has occurred for which a more specific error code is not available
If that's accurate, that makes things a little difficult to troubleshoot since the MDM WMI provider isn't giving us a meaningful error to work with.
I do have to wonder though, if you run the following, do you get back a reference to your user account or the computer's account?
whoami
Here's an example of the command, which in my case shows my user account:
If you've followed the instructions correctly on using psexec, what you should get is a reference to the computer's account.
Cheers,
Lain