Docker desktop throwing an error while deploying it with powershell script

I have a powershell script which should install Docker-Desktop with app on Windows Machine. After executing the powershell script it displays Docker Installed Successfully and through’s an error message "error listing credentials -err:exit status 1,out:‘A specified logon session does not exist. It may already have been terminated.’". This happens only on a particular machine, when I run the same script on multiple windows machines the Docker-Desktop installation and the app installation is successful as desired. It even works fine on the Azure Virtual Machines on Windows 11 Home and Pro Edition. This installation is done with elevated privileges.

Write-Host "Installing Docker..."
		start-process C:\Windows\System32\DockerInstaller.exe "install --quiet --accept-license" -Wait -NoNewWindow
		cd "C:\Program Files\Docker\Docker\"
		$ProgressPreference = 'SilentlyContinue'
		& 'C:\Windows\System32\DockerInstaller.exe'
		$env:Path += ";C:\Program Files\Docker\Docker\Resources\bin"
		$env:Path += ";C:\Program Files\Docker\Docker\Resources"
		Write-Host "Docker Installed successfully"
		$shell = New-Object -ComObject "Shell.Application"
		Add-Type -AssemblyName PresentationCore,PresentationFramework
		$Time=New-ScheduledTaskTrigger -AtLogon
		$p = "C:\PROGRA~2\XXX\XXXX\XXXX.ps1"
		$Action=New-ScheduledTaskAction -Execute "powershell.exe" -Argument "$p"
		Register-ScheduledTask -TaskName "XXXXXXXXX" -Trigger $Time -Action $Action -RunLevel Highest -Force

Your issue seems to be related to another topic

You shared your script which I asked for there, however, I still don’t know what could cause an error message like that. I share the same link I shared in the other topic hoping that it would give you some idea.

Have you tried installing Docker manually too?