- 1 - Clear "Users must enter a user name and password to use this computer"
- 2 - Reboot Windows
- 3 - WinRM Wait for Reboot
- 4 - Download Brave installer
- 5 - Run Brave installer via scheduled task
- 6 - Wait 2 minutes to allow scheduled task completes
- 7 - Delete Brave installer
- 8 - Remove Brave update services
Exported on 10-Nov-2021 21:08:36
Parameters
1 - Clear "Users must enter a user name and password to use this computer"
Clear Users must enter a user name and password to use this computer
with registry. It's identical to do the setting in GUI with netplwiz.exe
.
A GUI session is needed to run scheduled task with normal user privilege(instead of behaving as Administrators), so Brave can be installed in %LOCALAPPDATA%, other than the system profile("C:\Windows\System32\config\systemprofile\AppData\Local\BraveSoftware"), where normal users don't have access permission by default.
But in unattended automation, it's assumed we don't have local access to the host, and using RDP to establish a GUI session usually asks the user to do interactions. So clear the Users must enter a user name and password to use this computer
setting and do a system restart, will guarantee that the host boot with a GUI session logged in.
See doc for the meaning of {windowsUser.user}
and {windowsUser.password}
.
TODO: Remember the original state of this parameter, we should restore it after installing Brave.
Login as user {Windows User} on node {Windows Node}
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
$DefaultUsername = "{windowsUser.user}"
$DefaultPassword = "{windowsUser.password}"
Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1" -type String
Set-ItemProperty $RegPath "DefaultUsername" -Value "$DefaultUsername" -type String
Set-ItemProperty $RegPath "DefaultPassword" -Value "$DefaultPassword" -type String
2 - Reboot Windows
Reboot the computer.
Login as user {Windows User} on node {Windows Node}
shutdown -r -t 0
3 - WinRM Wait for Reboot
Wait for the WinRM port to come alive after system reboot.
It's seen on some system that it needs 40 seconds Post Wait Time
(When the system is going to reboot, previous successful ping will fail for the period the OS is down, then after the OS gets up, ping will succeed shortly. Post Wait Time
means after the port come back alive again, we wait Post Wait Time
more seconds before this step finish), although the port is open, but the WinRM service is not in a ready state. Less than this may result in error with the following steps.
The TCP Port
value should be the same with the WinRM Connection Type
of the Windows node value(check this on the Inputs tab) that we're connecting to, 5986 is the port of the default connection type.
on node {Windows Node}
4 - Download Brave installer
Download Brave installer from the official URL.
Login as user {Windows User} on node {Windows Node}
# Create parent directory
$DIR=Split-Path -Path {braveInstallerDownloadPath}
if (-not (Test-Path $DIR)) {
New-Item $DIR -ItemType Directory
}
# Download
if (-not (Test-Path {braveInstallerDownloadPath})) {
Invoke-WebRequest -Uri {braveInstallerDownloadUrl} -OutFile {braveInstallerDownloadPath}
}
5 - Run Brave installer via scheduled task
Create a scheduled task to run the installer, as a workaround to user privilege-related problem.
If running the Brave installer directly from WinRM, it is running under the Administrators' privileges, and install to the system profile("C:\Windows\System32\config\systemprofile\AppData\Local\BraveSoftware"), where normal users don't have access permission by default.
Scheduled tasks with -User
and -Password
set(equivalent to Run whether user is logged on or not
), also behave as Administrators(like running the Brave installer directly from WinRM). Currently it is found that only when the scheduled task is set as Run only when user is logged on
(no user / password set with Register-ScheduledTask
), the installer installs to the user's own storage space(%LOCALAPPDATA%). So we need to establish a GUI session before running the scheduled task, this is why we clear Users must enter a user name and password to use this computer
at the first place.
Login as user {Windows User} on node {Windows Node}
# Make the task start running after 15 seconds
$ts = New-TimeSpan -Seconds 15
$Trigger = New-ScheduledTaskTrigger -Once -At ((Get-date) + $ts)
$Action= New-ScheduledTaskAction -Execute {braveInstallerDownloadPath}
$Setting = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
Register-ScheduledTask -TaskName "Brave Browser install" -Trigger $Trigger -Action $Action -Settings $Setting -Force
6 - Wait 2 minutes to allow scheduled task completes
This is a simplified solution, the wiser method would be to continuously wait a short time period(say 1 second), check if the installer has finished running.
This task should finish within 1 minute for a modern computer, so 2 minutes of wait is enough(the task is scheduled to run after 15 seconds).
Login as user {Windows User} on node {Windows Node}
start-sleep 120
7 - Delete Brave installer
Delete the installer to free up disk space.
Login as user {Windows User} on node {Windows Node}
if (Test-Path {braveInstallerDownloadPath}) {
Remove-Item -Recurse {braveInstallerDownloadPath}
}
8 - Remove Brave update services
By default, the installer creates two scheduled tasks to automatically update the browser, we delete them in this step. And also delete the "Brave Browser install" task we created previously to run the installer.
Login as user {Windows User} on node {Windows Node}
Unregister-ScheduledTask -TaskName "Brave*" -Confirm:$false
Using Attune to install Brave Browser on Win10/Win11
Brave is a free and open-source web browser developed by Brave Software, Inc. based on the Chromium web browser, which Chrome is based on as well. Brave is a privacy-focused browser, which automatically blocks online advertisements and website trackers in its default settings.
In this blueprint, we download and run the installer, delete the installer package, then remove Brave update services(disable automatic update).
We use the
StandaloneSilentSetup
installer, to prevent user interaction during the installation. But we found that running the intaller directly with Attune(WinRM protocol), the actual privilege of the running session is Administrators rather than the normal user we're using, thus the browser is installed in the System Profile directory, which can't be accessed later by the user. To workaround this, we create a scheduled task to run the installer, it then behaves as the normal user, and installs the browser to the correct place.Tested on Windows 10/11
Pre-Blueprint Attune setup