aboutsummaryrefslogtreecommitdiff
path: root/.config/powershell/bootstrap.ps1
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2024-05-29 20:40:50 +0200
committersrdusr <trevorgray@srdusr.com>2024-05-29 20:40:50 +0200
commitd1f7b4aa13ade30843b4570d048ed550b65c082f (patch)
treee59eea7c2e10613111596d12607ad381e9040130 /.config/powershell/bootstrap.ps1
parentf8889096a379291218bf52955ef8f8a8a25f1b47 (diff)
downloaddotfiles-d1f7b4aa13ade30843b4570d048ed550b65c082f.tar.gz
dotfiles-d1f7b4aa13ade30843b4570d048ed550b65c082f.zip
Testing
Diffstat (limited to '.config/powershell/bootstrap.ps1')
-rw-r--r--.config/powershell/bootstrap.ps138
1 files changed, 2 insertions, 36 deletions
diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1
index 3e1df75..6ee4651 100644
--- a/.config/powershell/bootstrap.ps1
+++ b/.config/powershell/bootstrap.ps1
@@ -10,41 +10,7 @@ $oldUsername = $env:USERNAME
function handle_error {
param ($message)
Write-Host $message -ForegroundColor Red
- exit 1
-}
-
-# Rename the user account
-try {
- $userName = Get-WmiObject win32_userAccount -Filter "Name='$oldUsername'"
- if ($userName) {
- $result = $userName.Rename($newUsername)
- if ($result -ne 0) {
- handle_error "Failed to rename user."
- }
- } else {
- handle_error "User not found."
- }
- Write-Host "User account renamed successfully."
-} catch {
- handle_error "Failed to rename user account: $_"
-}
-
-# Rename the user profile folder
-try {
- Rename-Item -Path "C:\Users\$oldUsername" -NewName "C:\Users\$newUsername"
- Write-Host "User profile folder renamed successfully."
-} catch {
- handle_error "Failed to rename user profile folder: $_"
-}
-
-# Update registry entries
-try {
- $sid = (Get-WmiObject Win32_UserAccount -Filter "Name='$newUsername'").SID
- $regPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$sid"
- Set-ItemProperty -Path $regPath -Name "ProfileImagePath" -Value "C:\Users\$newUsername"
- Write-Host "Registry updated successfully."
-} catch {
- handle_error "Failed to update registry: $_"
+ #exit 1
}
# Install Chocolatey
@@ -218,4 +184,4 @@ Disable-WindowsKey
# Restart to apply changes
Write-Host "Restarting system to apply changes..."
-Restart-Computer -Force
+#Restart-Computer -Force