From 1f82f78c7f323ae5fefad97f64740ea04a267195 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 27 Jun 2023 00:57:24 +0200 Subject: [PATCH] Rename user using PowerShell function call --- scripts/Windows/OS/User.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Windows/OS/User.ps1 b/scripts/Windows/OS/User.ps1 index 98557039..5f733d4a 100644 --- a/scripts/Windows/OS/User.ps1 +++ b/scripts/Windows/OS/User.ps1 @@ -29,7 +29,7 @@ function New-PersonalUser([Context] $context) } Write-Information "Renaming the new User to $($context.UserName)"; - wmic useraccount where "name='$user'" rename "$context.UserName"; + Rename-LocalUser $user $context.UserName; Add-LocalGroupMember -Group "Administrators" -Member $user && Set-LocalUser $context.AdminName -Password (ConvertTo-SecureString -AsPlainText "Admin"); Write-Host "Registering setup script for all new users";