initial commit

This commit is contained in:
2024-07-16 01:25:46 -04:00
commit 139062a947
53 changed files with 8731 additions and 0 deletions

View File

@@ -0,0 +1,165 @@
# Cleans up default start menu and taskbar (some settings require Windows Pro)
function Install-PSModule {
param(
[Parameter(Position = 0, Mandatory = $true)]
[String[]]$Modules
)
Write-Output "`nChecking for necessary PowerShell modules..."
try {
# Set PowerShell to TLS 1.2 (https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/)
if ([Net.ServicePointManager]::SecurityProtocol -notcontains 'Tls12' -and [Net.ServicePointManager]::SecurityProtocol -notcontains 'Tls13') {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}
# Install NuGet package provider
if (!(Get-PackageProvider -ListAvailable -Name 'NuGet' -ErrorAction Ignore)) {
Write-Output 'Installing NuGet package provider...'
Install-PackageProvider -Name 'NuGet' -MinimumVersion 2.8.5.201 -Force
}
# Set PSGallery to trusted repository
Register-PSRepository -Default -InstallationPolicy 'Trusted' -ErrorAction Ignore
if (!(Get-PSRepository -Name 'PSGallery' -ErrorAction Ignore).InstallationPolicy -eq 'Trusted') {
Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted'
}
# Install & import modules
ForEach ($Module in $Modules) {
if (!(Get-Module -ListAvailable -Name $Module -ErrorAction Ignore)) {
Write-Output "`nInstalling $Module module..."
Install-Module -Name $Module -Force
Import-Module $Module
}
}
Write-Output 'Modules installed successfully.'
}
catch {
Write-Warning 'Unable to install modules.'
Write-Warning $_
exit 1
}
}
function Set-LayoutXML {
param (
[Parameter (Mandatory = $true)]
[String]$XMLFile
)
$Path = Split-Path -Path $XMLFile -Parent
if (!(Test-Path -PathType Container $Path)) {
New-Item -ItemType Directory -Path $Path | Out-Null
}
$XML = [XML]@'
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6">
<start:Group Name="">
<start:Tile Size="2x2" Column="2" Row="2" AppUserModelID="Microsoft.ScreenSketch_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="0" Row="2" AppUserModelID="Microsoft.Windows.Photos_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.WindowsStore_8wekyb3d8bbwe!App" />
<start:Tile Size="2x2" Column="4" Row="0" AppUserModelID="Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk" />
<start:Tile Size="2x2" Column="4" Row="2" AppUserModelID="MicrosoftCorporationII.QuickAssist_8wekyb3d8bbwe!App" />
</start:Group>
<start:Group Name="Office">
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Excel.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\PowerPoint.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Word.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Microsoft Teams.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Outlook.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
'@
$XML.Save("$XMLFile")
}
# Variables
$Modules = @('PolicyFileEditor')
$ComputerPolicyFile = ($env:SystemRoot + '\System32\GroupPolicy\Machine\registry.pol')
$UserPolicyFile = ($env:SystemRoot + '\System32\GroupPolicy\User\registry.pol')
$WinVer = Get-WmiObject win32_operatingsystem
Set-Location -Path $env:SystemRoot
# Define policies
$ComputerPolicies = @(
[PSCustomObject]@{Key = 'Software\Microsoft\Windows\CurrentVersion\Communications'; ValueName = 'ConfigureChatAutoInstall'; Data = '0'; Type = 'Dword' } # Disable Teams (personal) auto install (W11)
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\Windows Chat'; ValueName = 'ChatIcon'; Data = '2'; Type = 'Dword' } # Hide Chat icon by default (W11)
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\Windows Search'; ValueName = 'AllowCortana'; Data = '0'; Type = 'Dword' } # Disable Cortana
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\Windows Feeds'; ValueName = 'EnableFeeds'; Data = '0'; Type = 'Dword' } # Disable news/interests on taskbar
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\Windows Search'; ValueName = 'DisableWebSearch'; Data = '1'; Type = 'Dword' } # Disable web search in Start
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\Windows Search'; ValueName = 'AllowCloudSearch'; Data = '0'; Type = 'Dword' } # Disable web search in Start
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\CloudContent'; ValueName = 'DisableCloudOptimizedContent'; Data = '1'; Type = 'Dword' } # Disable cloud consumer content
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\CloudContent'; ValueName = 'DisableConsumerAccountStateContent'; Data = '1'; Type = 'Dword' } # Disable cloud consumer content
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\CloudContent'; ValueName = 'DisableWindowsConsumerFeatures'; Data = '1'; Type = 'Dword' } # Disable Consumer Experiences
)
$UserPolicies = @(
[PSCustomObject]@{Key = 'Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'; ValueName = 'TaskbarMn'; Data = '0'; Type = 'Dword' } # Disable Chat Icon
[PSCustomObject]@{Key = 'Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'; ValueName = 'HideSCAMeetNow'; Data = '1'; Type = 'Dword' } # Disable Meet Now icon (W10)
[PSCustomObject]@{Key = 'Software\Microsoft\Windows\CurrentVersion\Search'; ValueName = 'SearchboxTaskbarMode'; Data = '0'; Type = 'Dword' } # Set Search in taskbar, 1 = icon only, 0 = OFF
[PSCustomObject]@{Key = 'Software\Policies\Microsoft\Windows\CloudContent'; ValueName = 'DisableWindowsSpotlightFeatures'; Data = '1'; Type = 'Dword' } # Disable Windows Spotlight
)
# Set group policies
Install-PSModule $Modules
try {
Write-Output 'Setting group policies...'
$ComputerPolicies | Set-PolicyFileEntry -Path $ComputerPolicyFile -ErrorAction Stop
$UserPolicies | Set-PolicyFileEntry -Path $UserPolicyFile -ErrorAction Stop
gpupdate /force /wait:0 | Out-Null
Write-Output 'Group policies set.'
}
catch {
Write-Warning 'Unable to apply group policies.'
Write-Output $_
}
# Cleanup start menu & taskbar
try {
if ($WinVer.Caption -like '*Windows 11*') {
# Reset existing start menu layouts
$Layout = 'AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState'
Get-ChildItem 'C:\Users' | ForEach-Object { Remove-Item "C:\Users\$($_.Name)\$Layout" -Recurse -Force -ErrorAction Ignore }
# Remove chat & widget icons (current user)
$Path = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
$Settings = @(
[PSCustomObject]@{ Name = 'TaskbarMn'; Value = 0; PropertyType = 'DWORD'; } # Disable Chat Icon
[PSCustomObject]@{ Name = 'TaskbarDa'; Value = 0; PropertyType = 'DWORD'; } # Disable Widget Icon
)
if (!(Test-Path $Path)) { New-Item -Path $Path -Force | Out-Null }
$Settings | New-ItemProperty -Path $Path -Force | Out-Null
}
elseif ($WinVer.Caption -like '*Windows 10*') {
$LayoutModification = 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.xml'
Set-LayoutXML -XMLFile $LayoutModification
New-PSDrive -PSProvider 'Registry' -Name 'HKU' -Root 'HKEY_USERS' | Out-Null
$SubKeys = Get-ChildItem -Path 'HKU:' | Where-Object { $_.PSChildName -match '^S-\d-(?:\d+-){1,14}\d+$' } | Select-Object -ExpandProperty PSChildName
foreach ($SubKey in $SubKeys) {
$Path = "HKU:\$SubKey\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount"
if (Test-Path -Path $Path) { Remove-Item -Path $Path -Force -Recurse }
}
Remove-PSDrive -Name 'HKU'
}
# Restart Explorer
if ($env:USERNAME -ne 'defaultuser0') { Stop-Process -Name explorer -Force }
}
catch {
Write-Warning 'Unable to complete start menu & taskbar cleanup tasks.'
Write-Output $_
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
Invoke-RestMethod -Method "Post" -Uri "https://controls.wmpco.biz/api/StartAction" -Body '{"actionName": "Git Pull WMT Toolbox Git Repo on SMB"}'

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
$Argument=$args[0]
Write-Host "Passed Arguments: $Argument"
Rename-Computer -NewName "$Argument" -DomainCredential ity

View File

@@ -0,0 +1,34 @@
# Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
# $IP=$args[0]
# Write-Host "Passed Arguments: $Argument"
# $IP = Read-Host -Prompt 'Input IP Address 206.210.XX.XX'
$IP=$args[0]
Write-Host "Passed Arguments: $Argument"
# $IP = "206.210." + $Address
$MaskBits = 20
$Gateway = "206.210.40.1"
$Dns1 = "206.210.36.54"
$Dns2 = "206.210.41.1"
$IPType = "IPv4"
# Retrieve the network adapter that you want to configure
$adapter = Get-NetAdapter | ? {$_.Status -eq "up"}
# Remove any existing IP, gateway from our ipv4 adapter
If (($adapter | Get-NetIPConfiguration).IPv4Address.IPAddress) {
$adapter | Remove-NetIPAddress -AddressFamily $IPType -Confirm:$false
}
If (($adapter | Get-NetIPConfiguration).Ipv4DefaultGateway) {
$adapter | Remove-NetRoute -AddressFamily $IPType -Confirm:$false
}
# Configure the IP address and default gateway
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits `
-DefaultGateway $Gateway
# Configure the DNS client server IP addresses
$adapter | Set-DnsClientServerAddress -ServerAddresses $DNS1, $DNS2

View File

@@ -0,0 +1,8 @@
# Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n=allowGlobalConfirmation
# choco feature enable -n useFipsCompliantChecksums
choco upgrade all
choco install pswindowsupdate
# Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll
Get-WuInstall -AcceptAll -IgnoreReboot

View File

@@ -0,0 +1 @@
choco upgrade all -y

File diff suppressed because it is too large Load Diff