116 lines
No EOL
4.3 KiB
PowerShell
116 lines
No EOL
4.3 KiB
PowerShell
#Start WinRM Service
|
|
Start-Service WinRM -verbose
|
|
|
|
#Enable System restore
|
|
Enable-ComputerRestore -Drive "C:\" -confirm:$false
|
|
`
|
|
|
|
#Enable SMB and ICMP on Windows Firewall
|
|
Write-host 'Enable SMB and ICMP on Windows Firewall' -ForegroundColor yellow
|
|
Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -Enabled True
|
|
Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-Out)" -Enabled True
|
|
Set-NetFirewallRule -DisplayName "File and Printer Sharing (SMB-In)" -Enabled True
|
|
Set-NetFirewallRule -DisplayName "File and Printer Sharing (SMB-Out)" -Enabled True
|
|
|
|
|
|
`
|
|
New-Item -ItemType directory -Path C:\support -ErrorAction SilentlyContinue
|
|
New-Item -ItemType directory -Path C:\support\software -ErrorAction SilentlyContinue
|
|
New-Item -ItemType directory -Path C:\support\software\AnyDesk -ErrorAction SilentlyContinue
|
|
|
|
|
|
#Enable Unzip Function - updated below
|
|
#Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction -SilentlyContinue
|
|
#function unzip {
|
|
# param( [string]$ziparchive, [string]$extractpath )
|
|
# [System.IO.Compression.ZipFile]::ExtractToDirectory ( $ziparchive, $extractpath)
|
|
#}
|
|
|
|
|
|
|
|
# Enable Unzip Function
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction SilentlyContinue
|
|
|
|
function unzip {
|
|
param (
|
|
[string]$ziparchive, # The path to the zip archive
|
|
[string]$extractpath # The path where the contents will be extracted
|
|
)
|
|
|
|
if (-not (Test-Path $ziparchive)) {
|
|
Write-Error "The specified zip archive does not exist: $ziparchive"
|
|
return
|
|
}
|
|
|
|
if (-not (Test-Path $extractpath -PathType Container)) {
|
|
New-Item -ItemType Directory -Path $extractpath | Out-Null
|
|
}
|
|
|
|
try {
|
|
[System.IO.Compression.ZipFile]::ExtractToDirectory($ziparchive, $extractpath)
|
|
Write-Output "Extraction completed successfully."
|
|
} catch {
|
|
Write-Error "An error occurred during extraction: $_"
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
#Disable Windows 10 Fast startup
|
|
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name HiberbootEnabled -Value 0
|
|
#Set Power Plan to High Performance
|
|
powercfg.exe -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
|
|
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
|
|
powercfg -change -standby-timeout-ac 0
|
|
powercfg -change -hibernate-timeout-ac 0
|
|
|
|
|
|
# Disable display and sleep mode timeouts
|
|
Function DisableSleepTimeout {
|
|
Write-Output "Disabling sleep mode timeouts for AC..."
|
|
powercfg /X standby-timeout-ac 0
|
|
powercfg -change hibernate-timeout-ac 0
|
|
}
|
|
# Hide Taskbar People icon
|
|
Function HideTaskbarPeopleIcon {
|
|
Write-Output "Hiding People icon..."
|
|
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People")) {
|
|
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" | Out-Null
|
|
}
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Type DWord -Value 0
|
|
}
|
|
|
|
# Enable NumLock after startup
|
|
Function EnableNumlock {
|
|
Write-Output "Enabling NumLock after startup..."
|
|
If (!(Test-Path "HKU:")) {
|
|
New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS | Out-Null
|
|
}
|
|
Set-ItemProperty -Path "HKU:\.DEFAULT\Control Panel\Keyboard" -Name "InitialKeyboardIndicators" -Type DWord -Value 2147483650
|
|
Add-Type -AssemblyName System.Windows.Forms
|
|
If (!([System.Windows.Forms.Control]::IsKeyLocked('NumLock'))) {
|
|
$wsh = New-Object -ComObject WScript.Shell
|
|
$wsh.SendKeys('{NUMLOCK}')
|
|
}
|
|
}
|
|
|
|
|
|
|
|
##################
|
|
# .Net Framework 3.5
|
|
##################
|
|
#oldversionEnable-WindowsOptionalFeature -Online -FeatureName "NetFx3"
|
|
|
|
dism /online /cleanup-image /scanhealth
|
|
dism /online /cleanup-image /restorehealth
|
|
|
|
####################################################
|
|
# Install Office 2016 - Office 365 Business Premium
|
|
####################################################
|
|
$office = $apps | where-object {$_.displayname -like "*Office 16 Click-to-Run*"}
|
|
if($null -eq $office){
|
|
Invoke-RestMethod 'https://biztechsynergy.com.au/software/O365_BP_x64.zip' -Method 'GET' -OutFile "c:\support\software\O365_BP_x64.zip"
|
|
unzip "c:\support\software\O365_BP_x64.zip" "c:\support\software\office"
|
|
C:\support\software\office\setup.exe /configure 'C:\support\software\office\configuration.xml'
|
|
} |