More verbose output
This commit is contained in:
@@ -19,7 +19,9 @@ function CheckOfficeInstall {
|
|||||||
Write-Host "Microsoft Office is not installed."
|
Write-Host "Microsoft Office is not installed."
|
||||||
InstallOffice
|
InstallOffice
|
||||||
}
|
}
|
||||||
|
Write-Host "Activating Windows and Office..."
|
||||||
ActivateWindowsOffice
|
ActivateWindowsOffice
|
||||||
|
Write-Host "Windows and Office activation complete!"
|
||||||
}
|
}
|
||||||
|
|
||||||
function InstallOffice {
|
function InstallOffice {
|
||||||
@@ -34,6 +36,7 @@ function InstallOffice {
|
|||||||
$setupPath = "${driveLetter}:\Office\Setup64.exe"
|
$setupPath = "${driveLetter}:\Office\Setup64.exe"
|
||||||
Write-Host "Office setup path: $setupPath"
|
Write-Host "Office setup path: $setupPath"
|
||||||
Start-Process -FilePath $setupPath -Wait
|
Start-Process -FilePath $setupPath -Wait
|
||||||
|
Write-Host "Office installation complete!"
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Office setup files not found."
|
Write-Host "Office setup files not found."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ function UserReg {
|
|||||||
param (
|
param (
|
||||||
[string] $Username
|
[string] $Username
|
||||||
)
|
)
|
||||||
|
Write-Host "Loading $Username's HKU registry hive..."
|
||||||
$UserProfiles = Get-WmiObject Win32_UserProfile | Where-Object { $_.Special -eq $false }
|
$UserProfiles = Get-WmiObject Win32_UserProfile | Where-Object { $_.Special -eq $false }
|
||||||
$UserProfile = $UserProfiles | Where-Object { $_.LocalPath.EndsWith("\$Username") }
|
$UserProfile = $UserProfiles | Where-Object { $_.LocalPath.EndsWith("\$Username") }
|
||||||
if ($null -ne $UserProfile) {
|
if ($null -ne $UserProfile) {
|
||||||
@@ -10,6 +11,7 @@ function UserReg {
|
|||||||
if( -not (Test-Path -Path "Registry::HKEY_USERS\$UserSID" -PathType Container) ) {
|
if( -not (Test-Path -Path "Registry::HKEY_USERS\$UserSID" -PathType Container) ) {
|
||||||
REG LOAD HKEY_USERS\$UserSID "C:\Users\$Username\NTUSER.DAT"
|
REG LOAD HKEY_USERS\$UserSID "C:\Users\$Username\NTUSER.DAT"
|
||||||
}
|
}
|
||||||
|
Write-Host "Loaded $Username's HKU registry hive."
|
||||||
return $UserSID, "Registry::HKEY_USERS\$UserSID"
|
return $UserSID, "Registry::HKEY_USERS\$UserSID"
|
||||||
} else {
|
} else {
|
||||||
Write-Host "User profile for $Username not found."
|
Write-Host "User profile for $Username not found."
|
||||||
@@ -45,21 +47,25 @@ function SetupEleveReg {
|
|||||||
|
|
||||||
if ($null -ne $UserSID -and $null -ne $UserHKUPath) {
|
if ($null -ne $UserSID -and $null -ne $UserHKUPath) {
|
||||||
# Restrict access to Settings
|
# Restrict access to Settings
|
||||||
|
Write-Host "Restricting access to Settings..."
|
||||||
$ControlPanelKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"
|
$ControlPanelKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"
|
||||||
$ControlPanelValueName = "NoControlPanel"
|
$ControlPanelValueName = "NoControlPanel"
|
||||||
SetRegistry -regpath $ControlPanelKeyPath -regproperty $ControlPanelValueName
|
SetRegistry -regpath $ControlPanelKeyPath -regproperty $ControlPanelValueName
|
||||||
|
|
||||||
# Disable access to regedit
|
# Disable access to regedit
|
||||||
|
Write-Host "Disabling access to regedit..."
|
||||||
$REGKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\System"
|
$REGKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\System"
|
||||||
$REGValueName = "DisableRegistryTools"
|
$REGValueName = "DisableRegistryTools"
|
||||||
SetRegistry -regpath $REGKeyPath -regproperty $REGValueName
|
SetRegistry -regpath $REGKeyPath -regproperty $REGValueName
|
||||||
|
|
||||||
# Restrict access to Command Prompt
|
# Restrict access to Command Prompt
|
||||||
|
Write-Host "Restricting access to Command Prompt..."
|
||||||
$CMDKeyPath = "$UserHKUPath\Software\Policies\Microsoft\Windows\System"
|
$CMDKeyPath = "$UserHKUPath\Software\Policies\Microsoft\Windows\System"
|
||||||
$CMDValueName = "DisableCMD"
|
$CMDValueName = "DisableCMD"
|
||||||
SetRegistry -regpath $CMDKeyPath -regproperty $CMDValueName
|
SetRegistry -regpath $CMDKeyPath -regproperty $CMDValueName
|
||||||
|
|
||||||
# Add entries to DisallowRun for cmd.exe and powershell.exe
|
# 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"
|
$DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"
|
||||||
$DisallowRunValueName = "DisallowRun"
|
$DisallowRunValueName = "DisallowRun"
|
||||||
$DisallowRunPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun"
|
$DisallowRunPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun"
|
||||||
@@ -74,6 +80,8 @@ function SetupEleveReg {
|
|||||||
foreach ($valueName in $applications) {
|
foreach ($valueName in $applications) {
|
||||||
New-ItemProperty -Path $DisallowRunPath -Name $valueName -Value $valueName -PropertyType String
|
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
|
REG UNLOAD HKEY_USERS\$UserSID
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Unable to get the user's HKU registry."
|
Write-Host "Unable to get the user's HKU registry."
|
||||||
|
|||||||
Reference in New Issue
Block a user