Script for w10 kiosk mode

Trying to make a kiosk setup with an AD user. Found this script, but have no idea how to incorporate AD password too

"

pre class=“wp-block-syntaxhighlighter-code”> commented out as it generated errors, don’t know why"
$LogonDomain = “YourDomainName”
$User = “YourDomainUserAccount”

function Set-KioskMode {
param(
[string]$Domain,
[string]$UserName
)

$User = “$($Domain)$($UserName)”.TrimStart(’’)

$nameSpaceName=“root\cimv2\mdm\dmmap”
$className=“MDM_AssignedAccess”
$obj = Get-CimInstance -Namespace $namespaceName -ClassName $className
$obj.Configuration = @"
<?xml version=“1.0” encoding=“utf-8” ?>
<AssignedAccessConfiguration xmlns=“ttp://schemas.microsoft.com/AssignedAccess/2017/config”>
<Profiles>
<Profile Id="{6a8bebd2-xxxx-4b5e-8e4b-bc8b9421xxxx}">
<AllAppsList>
<AllowedApps>
<App AppUserModelId=“Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge” />
<App DesktopAppPath=“C:\Program Files\Notepad++\Notepad++.exe” />
</AllowedApps>
</AllAppsList>
<StartLayout>
<![CDATA[<LayoutModificationTemplate xmlns:defaultlayout=“ttp://schemas.microsoft.com/Start/2014/FullDefaultLayout” xmlns:start=“ttp://schemas.microsoft.com/Start/2014/StartLayout” Version=“1” xmlns=“ttp://schemas.microsoft.com/Start/2014/LayoutModification”>
<LayoutOptions StartTileGroupCellWidth=“6” />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth=“6”>
<start:Group Name=“Get Started”>
<start:DesktopApplicationTile Size=“2x2” Column=“2” Row=“0” DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Notepad++.lnk" />
</start:Group>
<start:Group Name=“Internet”>
<start:Tile Size=“2x2” Column=“2” Row=“0” AppUserModelID=“Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge” />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
]]>
</StartLayout>
<Taskbar ShowTaskbar=“false”/>
</Profile>
</Profiles>
<Configs>
<Config>
<AutoLogonAccount/>
<DefaultProfile Id="{6a8bebd2-xxxx-4b5e-8e4b-bc8b9421xxxx}"/>
</Config>
</Configs>
</AssignedAccessConfiguration>
"@

Set-CimInstance -CimInstance $obj
}

Set-KioskMode -Domain $LogonDomain -UserName $User

"
Script source: How to setup Kiosk mode on Windows 10 with AD user Account | Learn [Solve IT] (techdirectarchive.com)

Links have been left without a H, as post have a 2 links restriction

Hi,

Firstly, when posting code in the forum, please can you use the preformatted text </> button. It really helps us with readability, and copying and pasting your code (we don’t have to faff about replacing curly quote marks to get things working).

The author has a couple of links on his site for setting up the auto logon function. Is that what you’re having a problem with?

Ahh was looking for a code option, thx.

Following scipt works in junction with auto login, but it fails starting edge, and i don’t have a clue about the xml part

$LogonDomain = "CCMEXEC"
$User = "Kiosk"
function Set-KioskMode {
param(
    [string]$Domain,
    [string]$UserName
)
$User = "$($Domain)\$($UserName)".TrimStart('\')
$nameSpaceName="root\cimv2\mdm\dmmap"
$className="MDM_AssignedAccess"
$obj = Get-CimInstance -Namespace $namespaceName -ClassName $className
$obj.Configuration = @"
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;AssignedAccessConfiguration
    xmlns=&quot;http://schemas.microsoft.com/AssignedAccess/2017/config&quot;
    xmlns:rs5=&quot;http://schemas.microsoft.com/AssignedAccess/201810/config&quot;
    &gt;
    &lt;Profiles&gt;
        &lt;Profile Id=&quot;{AFF9DA33-AE89-4039-B646-3A5706E92957}&quot;&gt;
            &lt;KioskModeApp AppUserModelId=&quot;Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge&quot;/&gt;
        &lt;/Profile&gt;
    &lt;/Profiles&gt;
    &lt;Configs&gt;
        &lt;Config&gt;
            &lt;Account&gt;$($User)&lt;/Account&gt;
            &lt;DefaultProfile Id=&quot;{AFF9DA33-AE89-4039-B646-3A5706E92957}&quot;/&gt;
        &lt;/Config&gt;
    &lt;/Configs&gt;
&lt;/AssignedAccessConfiguration&gt;
"@
Set-CimInstance -CimInstance $obj
}
Set-KioskMode -Domain $LogonDomain -UserName $User