-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-administrator.ps1
37 lines (32 loc) · 1.04 KB
/
install-administrator.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#-----------------------------------------------------------------------------
#
# Copyright (c) 2022, Thierry Lelegard
# BSD-2-Clause license, see LICENSE.txt file
#
# Enable the Administrator account and make it appear in the login page.
# On Windows 10 Home, this is not done by default.
# See parameters documentation in install-common.ps1.
#
#-----------------------------------------------------------------------------
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[string]$Destination = "",
[switch]$ForceDownload = $false,
[switch]$GitHubActions = $false,
[switch]$NoInstall = $false,
[switch]$NoPause = $false
)
Write-Output "==== Windows Administrator account enabling procedure"
. "$PSScriptRoot\install-common.ps1"
if ($NoInstall) {
Write-Output "Builtin Windows feature, nothing to do"
}
elseif (-not $IsAdmin) {
# Execution for non-admin user, recurse for admin part.
Recurse-Admin
}
else {
Write-Output "Enabling $AdminUserName account ..."
net user $AdminUserName /active:yes
}
Exit-Script