More verbose output
This commit is contained in:
@@ -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."
|
||||
}
|
||||
|
||||
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user