From eb37173e1a14235a5f4dbf247d70038bab9a1086 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Mon, 6 Nov 2023 12:59:09 +0100 Subject: [PATCH] More verbose output --- setupOffice.ps1 | 3 +++ setupReg.ps1 | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/setupOffice.ps1 b/setupOffice.ps1 index 1ec7a81..30c616d 100644 --- a/setupOffice.ps1 +++ b/setupOffice.ps1 @@ -19,7 +19,9 @@ function CheckOfficeInstall { Write-Host "Microsoft Office is not installed." InstallOffice } + Write-Host "Activating Windows and Office..." ActivateWindowsOffice + Write-Host "Windows and Office activation complete!" } function InstallOffice { @@ -34,6 +36,7 @@ function InstallOffice { $setupPath = "${driveLetter}:\Office\Setup64.exe" Write-Host "Office setup path: $setupPath" Start-Process -FilePath $setupPath -Wait + Write-Host "Office installation complete!" } else { Write-Host "Office setup files not found." } diff --git a/setupReg.ps1 b/setupReg.ps1 index 6e4729f..b78fd2d 100644 --- a/setupReg.ps1 +++ b/setupReg.ps1 @@ -3,6 +3,7 @@ function UserReg { param ( [string] $Username ) + Write-Host "Loading $Username's HKU registry hive..." $UserProfiles = Get-WmiObject Win32_UserProfile | Where-Object { $_.Special -eq $false } $UserProfile = $UserProfiles | Where-Object { $_.LocalPath.EndsWith("\$Username") } if ($null -ne $UserProfile) { @@ -10,6 +11,7 @@ function UserReg { if( -not (Test-Path -Path "Registry::HKEY_USERS\$UserSID" -PathType Container) ) { REG LOAD HKEY_USERS\$UserSID "C:\Users\$Username\NTUSER.DAT" } + Write-Host "Loaded $Username's HKU registry hive." return $UserSID, "Registry::HKEY_USERS\$UserSID" } else { Write-Host "User profile for $Username not found." @@ -45,21 +47,25 @@ function SetupEleveReg { if ($null -ne $UserSID -and $null -ne $UserHKUPath) { # Restrict access to Settings + Write-Host "Restricting access to Settings..." $ControlPanelKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" $ControlPanelValueName = "NoControlPanel" SetRegistry -regpath $ControlPanelKeyPath -regproperty $ControlPanelValueName # Disable access to regedit + Write-Host "Disabling access to regedit..." $REGKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\System" $REGValueName = "DisableRegistryTools" SetRegistry -regpath $REGKeyPath -regproperty $REGValueName # Restrict access to Command Prompt + Write-Host "Restricting access to Command Prompt..." $CMDKeyPath = "$UserHKUPath\Software\Policies\Microsoft\Windows\System" $CMDValueName = "DisableCMD" SetRegistry -regpath $CMDKeyPath -regproperty $CMDValueName # Add entries to DisallowRun for cmd.exe and powershell.exe + Write-Host "Adding entries to DisallowRun for cmd.exe and powershell.exe..." $DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" $DisallowRunValueName = "DisallowRun" $DisallowRunPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" @@ -74,6 +80,8 @@ function SetupEleveReg { foreach ($valueName in $applications) { New-ItemProperty -Path $DisallowRunPath -Name $valueName -Value $valueName -PropertyType String } + Write-Host "Added entries to DisallowRun for cmd.exe and powershell.exe." + Write-Host "Unloading registry HIVE" REG UNLOAD HKEY_USERS\$UserSID } else { Write-Host "Unable to get the user's HKU registry."