Merge branch 'main' of https://gitea.tcse.us/tricounty/tcse-deploy
This commit is contained in:
commit
5997afae1f
@ -1,17 +0,0 @@
|
|||||||
# Add These Commands Under "Custom Scripts, Scripts to Run When First User Logs On"
|
|
||||||
|
|
||||||
# 1. CMD
|
|
||||||
curl -L https://gitea.tcse.us/tricounty/tcse-deploy/archive/main.zip --output C:\Scripts.zip
|
|
||||||
|
|
||||||
# 2. PS1
|
|
||||||
Expand-Archive -Path 'C:\Scripts.zip' -DestinationPath 'C:\Scripts'
|
|
||||||
timeout /t 15
|
|
||||||
Remove-Item -Path 'C:\Scripts.zip'
|
|
||||||
|
|
||||||
# 3. PS1
|
|
||||||
Move-Item -Path 'C:\Scripts\tcse-deploy\*' -Destination 'C:\Scripts'
|
|
||||||
timeout /t 15
|
|
||||||
Remove-Item -Path 'C:\Scripts\tcse-deploy\'
|
|
||||||
|
|
||||||
# 4. CMD
|
|
||||||
C:\Scripts\TCSE-Computer-Deploy.bat
|
|
||||||
@ -1,722 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
|
|
||||||
<!--https://schneegans.de/windows/unattend-generator/?LanguageMode=Unattended&UILanguage=en-US&Locale=en-US&Keyboard=00000409&GeoLocation=244&ProcessorArchitecture=amd64&BypassRequirementsCheck=true&BypassNetworkCheck=true&ComputerNameMode=Script&ComputerNameScript=return+Read-Host+-Prompt+%27Enter+computer+name%27%3B&CompactOsMode=Default&TimeZoneMode=Explicit&TimeZone=Central+Standard+Time&PartitionMode=Unattended&PartitionLayout=GPT&EspSize=600&RecoveryMode=Partition&RecoverySize=1500&WindowsEditionMode=Unattended&WindowsEdition=pro&UserAccountMode=Unattended&AccountName0=Tech&AccountPassword0=SandlotSlickBoat%2325&AccountGroup0=Administrators&AccountName1=&AccountName2=&AccountName3=&AccountName4=&AutoLogonMode=Own&PasswordExpirationMode=Unlimited&LockoutMode=Default&HideFiles=Hidden&TaskbarSearch=Icon&ShowFileExtensions=true&DisableWidgets=true&LeftTaskbar=true&DeleteTaskbarIcons=true&HideTaskViewButton=true&DisableBingResults=true&AllowPowerShellScripts=true&DisableAppSuggestions=true&PreventDeviceEncryption=true&HideEdgeFre=true&WifiMode=Skip&ExpressSettings=DisableAll&KeysMode=Skip&ColorMode=Custom&SystemColorTheme=Light&AppsColorTheme=Light&AccentColor=%230078d4&WallpaperMode=Solid&WallpaperColor=%230978d3&Remove3DViewer=true&RemoveBingSearch=true&RemoveCalculator=true&RemoveCamera=true&RemoveClipchamp=true&RemoveClock=true&RemoveCopilot=true&RemoveCortana=true&RemoveDevHome=true&RemoveFamily=true&RemoveFeedbackHub=true&RemoveGetHelp=true&RemoveHandwriting=true&RemoveInternetExplorer=true&RemoveMailCalendar=true&RemoveMaps=true&RemoveMathInputPanel=true&RemoveMediaFeatures=true&RemoveMixedReality=true&RemoveZuneVideo=true&RemoveNews=true&RemoveOffice365=true&RemoveOneDrive=true&RemoveOneNote=true&RemoveOneSync=true&RemoveOpenSSHClient=true&RemoveOutlook=true&RemovePaint3D=true&RemovePeople=true&RemovePhotos=true&RemovePowerAutomate=true&RemovePowerShell2=true&RemovePowerShellISE=true&RemoveQuickAssist=true&RemoveRecall=true&RemoveRdpClient=true&RemoveSkype=true&RemoveSolitaire=true&RemoveSpeech=true&RemoveStepsRecorder=true&RemoveStickyNotes=true&RemoveTeams=true&RemoveGetStarted=true&RemoveToDo=true&RemoveVoiceRecorder=true&RemoveWallet=true&RemoveWeather=true&RemoveFaxAndScan=true&RemoveWindowsHello=true&RemoveWindowsMediaPlayer=true&RemoveZuneMusic=true&RemoveWordPad=true&RemoveXboxApps=true&RemoveYourPhone=true&StartTilesMode=Default&StartPinsMode=Empty&FirstLogonScript0=curl+-L+https%3A%2F%2Fgitea.tcse.us%2Ftricounty%2Ftcse-deploy%2Farchive%2Fmain.zip+%2D%2Doutput+C%3A%5CScripts.zip&FirstLogonScriptType0=Cmd&FirstLogonScript1=Expand-Archive+-Path+%27C%3A%5CScripts.zip%27+-DestinationPath+%27C%3A%5CScripts%27%0D%0ARemove-Item+-Path+%27C%3A%5CScripts.zip%27%0D%0AMove-Item+-Path+%27C%3A%5CScripts%5Ctcse-deploy%5C*%27+-Destination+%27C%3A%5CScripts%27%0D%0ARemove-Item+-Path+%27C%3A%5CScripts%5Ctcse-deploy%5C%27&FirstLogonScriptType1=Ps1&FirstLogonScript2=C%3A%5CScripts%5CTCSE-Computer-Deploy.bat&FirstLogonScriptType2=Cmd&WdacMode=Skip-->
|
|
||||||
<settings pass="offlineServicing"></settings>
|
|
||||||
<settings pass="windowsPE">
|
|
||||||
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<SetupUILanguage>
|
|
||||||
<UILanguage>en-US</UILanguage>
|
|
||||||
</SetupUILanguage>
|
|
||||||
<InputLocale>0409:00000409</InputLocale>
|
|
||||||
<SystemLocale>en-US</SystemLocale>
|
|
||||||
<UILanguage>en-US</UILanguage>
|
|
||||||
<UserLocale>en-US</UserLocale>
|
|
||||||
</component>
|
|
||||||
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<ImageInstall>
|
|
||||||
<OSImage>
|
|
||||||
<InstallTo>
|
|
||||||
<DiskID>0</DiskID>
|
|
||||||
<PartitionID>3</PartitionID>
|
|
||||||
</InstallTo>
|
|
||||||
</OSImage>
|
|
||||||
</ImageInstall>
|
|
||||||
<UserData>
|
|
||||||
<ProductKey>
|
|
||||||
<Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</Key>
|
|
||||||
</ProductKey>
|
|
||||||
<AcceptEula>true</AcceptEula>
|
|
||||||
</UserData>
|
|
||||||
<UseConfigurationSet>false</UseConfigurationSet>
|
|
||||||
<RunSynchronous>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>1</Order>
|
|
||||||
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo SELECT DISK=0&echo CLEAN&echo CONVERT GPT&echo CREATE PARTITION EFI SIZE=600&echo FORMAT QUICK FS=FAT32 LABEL="System"&echo CREATE PARTITION MSR SIZE=16)"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>2</Order>
|
|
||||||
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo CREATE PARTITION PRIMARY&echo SHRINK MINIMUM=1500&echo FORMAT QUICK FS=NTFS LABEL="Windows"&echo CREATE PARTITION PRIMARY&echo FORMAT QUICK FS=NTFS LABEL="Recovery")"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>3</Order>
|
|
||||||
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo SET ID="de94bba4-06d1-4d40-a16a-bfd50179d6ac"&echo GPT ATTRIBUTES=0x8000000000000001)"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>4</Order>
|
|
||||||
<Path>cmd.exe /c "diskpart.exe /s "X:\diskpart.txt" >>"X:\diskpart.log" || ( type "X:\diskpart.log" & echo diskpart encountered an error. & pause & exit /b 1 )"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>5</Order>
|
|
||||||
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>6</Order>
|
|
||||||
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>7</Order>
|
|
||||||
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
</RunSynchronous>
|
|
||||||
</component>
|
|
||||||
</settings>
|
|
||||||
<settings pass="generalize"></settings>
|
|
||||||
<settings pass="specialize">
|
|
||||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<ComputerName>TEMPNAME</ComputerName>
|
|
||||||
<TimeZone>Central Standard Time</TimeZone>
|
|
||||||
</component>
|
|
||||||
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<RunSynchronous>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>1</Order>
|
|
||||||
<Path>powershell.exe -NoProfile -Command "$xml = [xml]::new(); $xml.Load('C:\Windows\Panther\unattend.xml'); $sb = [scriptblock]::Create( $xml.unattend.Extensions.ExtractScript ); Invoke-Command -ScriptBlock $sb -ArgumentList $xml;"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>2</Order>
|
|
||||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\Specialize.ps1' -Raw | Invoke-Expression;"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>3</Order>
|
|
||||||
<Path>reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>4</Order>
|
|
||||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\DefaultUser.ps1' -Raw | Invoke-Expression;"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>5</Order>
|
|
||||||
<Path>reg.exe unload "HKU\DefaultUser"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
</RunSynchronous>
|
|
||||||
</component>
|
|
||||||
</settings>
|
|
||||||
<settings pass="auditSystem"></settings>
|
|
||||||
<settings pass="auditUser"></settings>
|
|
||||||
<settings pass="oobeSystem">
|
|
||||||
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<InputLocale>0409:00000409</InputLocale>
|
|
||||||
<SystemLocale>en-US</SystemLocale>
|
|
||||||
<UILanguage>en-US</UILanguage>
|
|
||||||
<UserLocale>en-US</UserLocale>
|
|
||||||
</component>
|
|
||||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<UserAccounts>
|
|
||||||
<LocalAccounts>
|
|
||||||
<LocalAccount wcm:action="add">
|
|
||||||
<Name>Tech</Name>
|
|
||||||
<Group>Administrators</Group>
|
|
||||||
<Password>
|
|
||||||
<Value>SandlotSlickBoat#25</Value>
|
|
||||||
<PlainText>true</PlainText>
|
|
||||||
</Password>
|
|
||||||
</LocalAccount>
|
|
||||||
</LocalAccounts>
|
|
||||||
</UserAccounts>
|
|
||||||
<AutoLogon>
|
|
||||||
<Username>Tech</Username>
|
|
||||||
<Enabled>true</Enabled>
|
|
||||||
<LogonCount>1</LogonCount>
|
|
||||||
<Password>
|
|
||||||
<Value>SandlotSlickBoat#25</Value>
|
|
||||||
<PlainText>true</PlainText>
|
|
||||||
</Password>
|
|
||||||
</AutoLogon>
|
|
||||||
<OOBE>
|
|
||||||
<ProtectYourPC>3</ProtectYourPC>
|
|
||||||
<HideEULAPage>true</HideEULAPage>
|
|
||||||
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
|
|
||||||
<HideOnlineAccountScreens>false</HideOnlineAccountScreens>
|
|
||||||
</OOBE>
|
|
||||||
<FirstLogonCommands>
|
|
||||||
<SynchronousCommand wcm:action="add">
|
|
||||||
<Order>1</Order>
|
|
||||||
<CommandLine>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\FirstLogon.ps1' -Raw | Invoke-Expression;"</CommandLine>
|
|
||||||
</SynchronousCommand>
|
|
||||||
</FirstLogonCommands>
|
|
||||||
</component>
|
|
||||||
</settings>
|
|
||||||
<Extensions xmlns="https://schneegans.de/windows/unattend-generator/">
|
|
||||||
<ExtractScript>
|
|
||||||
param(
|
|
||||||
[xml] $Document
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach( $file in $Document.unattend.Extensions.File ) {
|
|
||||||
$path = [System.Environment]::ExpandEnvironmentVariables(
|
|
||||||
$file.GetAttribute( 'path' )
|
|
||||||
);
|
|
||||||
mkdir -Path( $path | Split-Path -Parent ) -ErrorAction 'SilentlyContinue';
|
|
||||||
$content = $file.InnerText.Trim();
|
|
||||||
if( $file.GetAttribute( 'transformation' ) -ieq 'Base64' ) {
|
|
||||||
[System.IO.File]::WriteAllBytes( $path, [System.Convert]::FromBase64String( $content ) );
|
|
||||||
} else {
|
|
||||||
$encoding = switch( [System.IO.Path]::GetExtension( $path ) ) {
|
|
||||||
{ $_ -in '.ps1', '.xml' } { [System.Text.Encoding]::UTF8; }
|
|
||||||
{ $_ -in '.reg', '.vbs', '.js' } { [System.Text.UnicodeEncoding]::new( $false, $true ); }
|
|
||||||
default { [System.Text.Encoding]::Default; }
|
|
||||||
};
|
|
||||||
[System.IO.File]::WriteAllBytes( $path, ( $encoding.GetPreamble() + $encoding.GetBytes( $content ) ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</ExtractScript>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\GetComputerName.ps1" transformation="Text">
|
|
||||||
return Read-Host -Prompt 'Enter computer name';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\SetComputerName.ps1" transformation="Text">
|
|
||||||
$ErrorActionPreference = 'Stop';
|
|
||||||
Set-StrictMode -Version 'Latest';
|
|
||||||
& {
|
|
||||||
$newName = ( Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\ComputerName.txt' -Raw ).Trim();
|
|
||||||
if( [string]::IsNullOrWhitespace( $newName ) ) {
|
|
||||||
throw "No computer name was provided.";
|
|
||||||
}
|
|
||||||
|
|
||||||
$keys = @(
|
|
||||||
@{
|
|
||||||
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName';
|
|
||||||
Name = 'ComputerName';
|
|
||||||
};
|
|
||||||
@{
|
|
||||||
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters';
|
|
||||||
Name = 'Hostname';
|
|
||||||
};
|
|
||||||
@{
|
|
||||||
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters';
|
|
||||||
Name = 'NV Hostname';
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
while( $true ) {
|
|
||||||
foreach( $key in $keys ) {
|
|
||||||
Set-ItemProperty @key -Type 'String' -Value $newName;
|
|
||||||
}
|
|
||||||
Start-Sleep -Milliseconds 50;
|
|
||||||
}
|
|
||||||
} *>&1 >> 'C:\Windows\Setup\Scripts\SetComputerName.log';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\RemovePackages.ps1" transformation="Text">
|
|
||||||
$selectors = @(
|
|
||||||
'Microsoft.Microsoft3DViewer';
|
|
||||||
'Microsoft.BingSearch';
|
|
||||||
'Microsoft.WindowsCalculator';
|
|
||||||
'Microsoft.WindowsCamera';
|
|
||||||
'Clipchamp.Clipchamp';
|
|
||||||
'Microsoft.WindowsAlarms';
|
|
||||||
'Microsoft.549981C3F5F10';
|
|
||||||
'Microsoft.Windows.DevHome';
|
|
||||||
'MicrosoftCorporationII.MicrosoftFamily';
|
|
||||||
'Microsoft.WindowsFeedbackHub';
|
|
||||||
'Microsoft.GetHelp';
|
|
||||||
'Microsoft.Getstarted';
|
|
||||||
'microsoft.windowscommunicationsapps';
|
|
||||||
'Microsoft.WindowsMaps';
|
|
||||||
'Microsoft.MixedReality.Portal';
|
|
||||||
'Microsoft.BingNews';
|
|
||||||
'Microsoft.MicrosoftOfficeHub';
|
|
||||||
'Microsoft.Office.OneNote';
|
|
||||||
'Microsoft.OutlookForWindows';
|
|
||||||
'Microsoft.MSPaint';
|
|
||||||
'Microsoft.People';
|
|
||||||
'Microsoft.Windows.Photos';
|
|
||||||
'Microsoft.PowerAutomateDesktop';
|
|
||||||
'MicrosoftCorporationII.QuickAssist';
|
|
||||||
'Microsoft.SkypeApp';
|
|
||||||
'Microsoft.MicrosoftSolitaireCollection';
|
|
||||||
'Microsoft.MicrosoftStickyNotes';
|
|
||||||
'MicrosoftTeams';
|
|
||||||
'MSTeams';
|
|
||||||
'Microsoft.Todos';
|
|
||||||
'Microsoft.WindowsSoundRecorder';
|
|
||||||
'Microsoft.Wallet';
|
|
||||||
'Microsoft.BingWeather';
|
|
||||||
'Microsoft.Xbox.TCUI';
|
|
||||||
'Microsoft.XboxApp';
|
|
||||||
'Microsoft.XboxGameOverlay';
|
|
||||||
'Microsoft.XboxGamingOverlay';
|
|
||||||
'Microsoft.XboxIdentityProvider';
|
|
||||||
'Microsoft.XboxSpeechToTextOverlay';
|
|
||||||
'Microsoft.GamingApp';
|
|
||||||
'Microsoft.YourPhone';
|
|
||||||
'Microsoft.ZuneMusic';
|
|
||||||
'Microsoft.ZuneVideo';
|
|
||||||
);
|
|
||||||
$getCommand = {
|
|
||||||
Get-AppxProvisionedPackage -Online;
|
|
||||||
};
|
|
||||||
$filterCommand = {
|
|
||||||
$_.DisplayName -eq $selector;
|
|
||||||
};
|
|
||||||
$removeCommand = {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter( Mandatory, ValueFromPipeline )]
|
|
||||||
$InputObject
|
|
||||||
);
|
|
||||||
process {
|
|
||||||
$InputObject | Remove-AppxProvisionedPackage -AllUsers -Online -ErrorAction 'Continue';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$type = 'Package';
|
|
||||||
$logfile = 'C:\Windows\Setup\Scripts\RemovePackages.log';
|
|
||||||
& {
|
|
||||||
$installed = & $getCommand;
|
|
||||||
foreach( $selector in $selectors ) {
|
|
||||||
$result = [ordered] @{
|
|
||||||
Selector = $selector;
|
|
||||||
};
|
|
||||||
$found = $installed | Where-Object -FilterScript $filterCommand;
|
|
||||||
if( $found ) {
|
|
||||||
$result.Output = $found | & $removeCommand;
|
|
||||||
if( $? ) {
|
|
||||||
$result.Message = "$type removed.";
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not removed.";
|
|
||||||
$result.Error = $Error[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not installed.";
|
|
||||||
}
|
|
||||||
$result | ConvertTo-Json -Depth 3 -Compress;
|
|
||||||
}
|
|
||||||
} *>&1 >> $logfile;
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\RemoveCapabilities.ps1" transformation="Text">
|
|
||||||
$selectors = @(
|
|
||||||
'Print.Fax.Scan';
|
|
||||||
'Language.Handwriting';
|
|
||||||
'Browser.InternetExplorer';
|
|
||||||
'MathRecognizer';
|
|
||||||
'OneCoreUAP.OneSync';
|
|
||||||
'OpenSSH.Client';
|
|
||||||
'Microsoft.Windows.PowerShell.ISE';
|
|
||||||
'App.Support.QuickAssist';
|
|
||||||
'Language.Speech';
|
|
||||||
'Language.TextToSpeech';
|
|
||||||
'App.StepsRecorder';
|
|
||||||
'Hello.Face.18967';
|
|
||||||
'Hello.Face.Migration.18967';
|
|
||||||
'Hello.Face.20134';
|
|
||||||
'Media.WindowsMediaPlayer';
|
|
||||||
'Microsoft.Windows.WordPad';
|
|
||||||
);
|
|
||||||
$getCommand = {
|
|
||||||
Get-WindowsCapability -Online | Where-Object -Property 'State' -NotIn -Value @(
|
|
||||||
'NotPresent';
|
|
||||||
'Removed';
|
|
||||||
);
|
|
||||||
};
|
|
||||||
$filterCommand = {
|
|
||||||
($_.Name -split '~')[0] -eq $selector;
|
|
||||||
};
|
|
||||||
$removeCommand = {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter( Mandatory, ValueFromPipeline )]
|
|
||||||
$InputObject
|
|
||||||
);
|
|
||||||
process {
|
|
||||||
$InputObject | Remove-WindowsCapability -Online -ErrorAction 'Continue';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$type = 'Capability';
|
|
||||||
$logfile = 'C:\Windows\Setup\Scripts\RemoveCapabilities.log';
|
|
||||||
& {
|
|
||||||
$installed = & $getCommand;
|
|
||||||
foreach( $selector in $selectors ) {
|
|
||||||
$result = [ordered] @{
|
|
||||||
Selector = $selector;
|
|
||||||
};
|
|
||||||
$found = $installed | Where-Object -FilterScript $filterCommand;
|
|
||||||
if( $found ) {
|
|
||||||
$result.Output = $found | & $removeCommand;
|
|
||||||
if( $? ) {
|
|
||||||
$result.Message = "$type removed.";
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not removed.";
|
|
||||||
$result.Error = $Error[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not installed.";
|
|
||||||
}
|
|
||||||
$result | ConvertTo-Json -Depth 3 -Compress;
|
|
||||||
}
|
|
||||||
} *>&1 >> $logfile;
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\RemoveFeatures.ps1" transformation="Text">
|
|
||||||
$selectors = @(
|
|
||||||
'MediaPlayback';
|
|
||||||
'MicrosoftWindowsPowerShellV2Root';
|
|
||||||
'Microsoft-RemoteDesktopConnection';
|
|
||||||
'Recall';
|
|
||||||
);
|
|
||||||
$getCommand = {
|
|
||||||
Get-WindowsOptionalFeature -Online | Where-Object -Property 'State' -NotIn -Value @(
|
|
||||||
'Disabled';
|
|
||||||
'DisabledWithPayloadRemoved';
|
|
||||||
);
|
|
||||||
};
|
|
||||||
$filterCommand = {
|
|
||||||
$_.FeatureName -eq $selector;
|
|
||||||
};
|
|
||||||
$removeCommand = {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter( Mandatory, ValueFromPipeline )]
|
|
||||||
$InputObject
|
|
||||||
);
|
|
||||||
process {
|
|
||||||
$InputObject | Disable-WindowsOptionalFeature -Online -Remove -NoRestart -ErrorAction 'Continue';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$type = 'Feature';
|
|
||||||
$logfile = 'C:\Windows\Setup\Scripts\RemoveFeatures.log';
|
|
||||||
& {
|
|
||||||
$installed = & $getCommand;
|
|
||||||
foreach( $selector in $selectors ) {
|
|
||||||
$result = [ordered] @{
|
|
||||||
Selector = $selector;
|
|
||||||
};
|
|
||||||
$found = $installed | Where-Object -FilterScript $filterCommand;
|
|
||||||
if( $found ) {
|
|
||||||
$result.Output = $found | & $removeCommand;
|
|
||||||
if( $? ) {
|
|
||||||
$result.Message = "$type removed.";
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not removed.";
|
|
||||||
$result.Error = $Error[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not installed.";
|
|
||||||
}
|
|
||||||
$result | ConvertTo-Json -Depth 3 -Compress;
|
|
||||||
}
|
|
||||||
} *>&1 >> $logfile;
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\TaskbarIcons.ps1" transformation="Text">
|
|
||||||
Remove-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband' -Name '*';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\SetStartPins.ps1" transformation="Text">
|
|
||||||
$json = '{"pinnedList":[]}';
|
|
||||||
if( [System.Environment]::OSVersion.Version.Build -lt 20000 ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$key = 'Registry::HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start';
|
|
||||||
New-Item -Path $key -ItemType 'Directory' -ErrorAction 'SilentlyContinue';
|
|
||||||
Set-ItemProperty -LiteralPath $key -Name 'ConfigureStartPins' -Value $json -Type 'String';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\SetColorTheme.ps1" transformation="Text">
|
|
||||||
$lightThemeSystem = 1;
|
|
||||||
$lightThemeApps = 1;
|
|
||||||
$accentColorOnStart = 0;
|
|
||||||
$enableTransparency = 0;
|
|
||||||
$htmlAccentColor = '#0078D4';
|
|
||||||
& {
|
|
||||||
$params = @{
|
|
||||||
LiteralPath = 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize';
|
|
||||||
Force = $true;
|
|
||||||
Type = 'DWord';
|
|
||||||
};
|
|
||||||
Set-ItemProperty @params -Name 'SystemUsesLightTheme' -Value $lightThemeSystem;
|
|
||||||
Set-ItemProperty @params -Name 'AppsUseLightTheme' -Value $lightThemeApps;
|
|
||||||
Set-ItemProperty @params -Name 'ColorPrevalence' -Value $accentColorOnStart;
|
|
||||||
Set-ItemProperty @params -Name 'EnableTransparency' -Value $enableTransparency;
|
|
||||||
};
|
|
||||||
& {
|
|
||||||
Add-Type -AssemblyName 'System.Drawing';
|
|
||||||
$accentColor = [System.Drawing.ColorTranslator]::FromHtml( $htmlAccentColor );
|
|
||||||
|
|
||||||
function ConvertTo-DWord {
|
|
||||||
param(
|
|
||||||
[System.Drawing.Color]
|
|
||||||
$Color
|
|
||||||
);
|
|
||||||
|
|
||||||
[byte[]] $bytes = @(
|
|
||||||
$Color.R;
|
|
||||||
$Color.G;
|
|
||||||
$Color.B;
|
|
||||||
$Color.A;
|
|
||||||
);
|
|
||||||
return [System.BitConverter]::ToUInt32( $bytes, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
$startColor = [System.Drawing.Color]::FromArgb( 0xD2, $accentColor );
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name 'StartColorMenu' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name 'AccentColorMenu' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\DWM' -Name 'AccentColor' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
||||||
$params = @{
|
|
||||||
LiteralPath = 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent';
|
|
||||||
Name = 'AccentPalette';
|
|
||||||
};
|
|
||||||
$palette = Get-ItemPropertyValue @params;
|
|
||||||
$index = 20;
|
|
||||||
$palette[ $index++ ] = $accentColor.R;
|
|
||||||
$palette[ $index++ ] = $accentColor.G;
|
|
||||||
$palette[ $index++ ] = $accentColor.B;
|
|
||||||
$palette[ $index++ ] = $accentColor.A;
|
|
||||||
Set-ItemProperty @params -Value $palette -Type 'Binary' -Force;
|
|
||||||
};
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\SetWallpaper.ps1" transformation="Text">
|
|
||||||
Add-Type -TypeDefinition '
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
public static class WallpaperSetter {
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern bool SetSysColors(
|
|
||||||
int cElements,
|
|
||||||
int[] lpaElements,
|
|
||||||
int[] lpaRgbValues
|
|
||||||
);
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern bool SystemParametersInfo(
|
|
||||||
uint uiAction,
|
|
||||||
uint uiParam,
|
|
||||||
string pvParam,
|
|
||||||
uint fWinIni
|
|
||||||
);
|
|
||||||
|
|
||||||
public static void SetDesktopBackground(Color color) {
|
|
||||||
SystemParametersInfo(20, 0, "", 0);
|
|
||||||
SetSysColors(1, new int[] { 1 }, new int[] { ColorTranslator.ToWin32(color) });
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetDesktopImage(string file) {
|
|
||||||
SystemParametersInfo(20, 0, file, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
' -ReferencedAssemblies 'System.Drawing';
|
|
||||||
|
|
||||||
function Set-WallpaperColor {
|
|
||||||
param(
|
|
||||||
[string]
|
|
||||||
$HtmlColor
|
|
||||||
);
|
|
||||||
|
|
||||||
$color = [System.Drawing.ColorTranslator]::FromHtml( $HtmlColor );
|
|
||||||
[WallpaperSetter]::SetDesktopBackground( $color );
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers' -Name 'BackgroundType' -Type 'DWord' -Value 1 -Force;
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Desktop' -Name 'WallPaper' -Type 'String' -Value '' -Force;
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Colors' -Name 'Background' -Type 'String' -Value "$($color.R) $($color.G) $($color.B)" -Force;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Set-WallpaperImage {
|
|
||||||
param(
|
|
||||||
[string]
|
|
||||||
$LiteralPath
|
|
||||||
);
|
|
||||||
|
|
||||||
[WallpaperSetter]::SetDesktopImage( $LiteralPath );
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers' -Name 'BackgroundType' -Type 'DWord' -Value 0 -Force;
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Desktop' -Name 'WallPaper' -Type 'String' -Value $LiteralPath -Force;
|
|
||||||
}
|
|
||||||
Set-WallpaperColor -HtmlColor '#0978D3';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\unattend-01.cmd" transformation="Text">
|
|
||||||
curl -L https://gitea.tcse.us/tricounty/tcse-deploy/archive/main.zip --output C:\Scripts.zip
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\unattend-02.ps1" transformation="Text">
|
|
||||||
Expand-Archive -Path 'C:\Scripts.zip' -DestinationPath 'C:\Scripts'
|
|
||||||
Remove-Item -Path 'C:\Scripts.zip'
|
|
||||||
Move-Item -Path 'C:\Scripts\tcse-deploy\*' -Destination 'C:\Scripts'
|
|
||||||
Remove-Item -Path 'C:\Scripts\tcse-deploy\'
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\unattend-03.cmd" transformation="Text">
|
|
||||||
C:\Scripts\TCSE-Computer-Deploy.bat
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\Specialize.ps1" transformation="Text">
|
|
||||||
$scripts = @(
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\GetComputerName.ps1' -Raw | Invoke-Expression > 'C:\Windows\Setup\Scripts\ComputerName.txt';
|
|
||||||
Start-Process -FilePath ( Get-Process -Id $PID ).Path -ArgumentList '-NoProfile', '-Command', 'Get-Content -LiteralPath "C:\Windows\Setup\Scripts\SetComputerName.ps1" -Raw | Invoke-Expression;' -WindowStyle 'Hidden';
|
|
||||||
Start-Sleep -Seconds 10;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v BypassNRO /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate' -Force -ErrorAction 'SilentlyContinue';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Remove-Item -LiteralPath 'C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk', 'C:\Windows\System32\OneDriveSetup.exe', 'C:\Windows\SysWOW64\OneDriveSetup.exe' -ErrorAction 'Continue';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' -Force -ErrorAction 'SilentlyContinue';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v ConfigureChatAutoInstall /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemovePackages.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemoveCapabilities.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemoveFeatures.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
net.exe accounts /maxpwage:UNLIMITED;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Set-ExecutionPolicy -Scope 'LocalMachine' -ExecutionPolicy 'RemoteSigned' -Force;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v HideFirstRunExperience /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetStartPins.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
& {
|
|
||||||
[float] $complete = 0;
|
|
||||||
[float] $increment = 100 / $scripts.Count;
|
|
||||||
foreach( $script in $scripts ) {
|
|
||||||
Write-Progress -Activity 'Running scripts to customize your Windows installation. Do not close this window.' -PercentComplete $complete;
|
|
||||||
& $script;
|
|
||||||
$complete += $increment;
|
|
||||||
}
|
|
||||||
} *>&1 >> "C:\Windows\Setup\Scripts\Specialize.log";
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\UserOnce.ps1" transformation="Text">
|
|
||||||
$scripts = @(
|
|
||||||
{
|
|
||||||
Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\TaskbarIcons.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Search' -Name 'SearchboxTaskbarMode' -Type 'DWord' -Value 1;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetColorTheme.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetWallpaper.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Process -Name 'explorer' -ErrorAction 'SilentlyContinue' | Where-Object -FilterScript {
|
|
||||||
$_.SessionId -eq ( Get-Process -Id $PID ).SessionId;
|
|
||||||
} | Stop-Process -Force;
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
& {
|
|
||||||
[float] $complete = 0;
|
|
||||||
[float] $increment = 100 / $scripts.Count;
|
|
||||||
foreach( $script in $scripts ) {
|
|
||||||
Write-Progress -Activity 'Running scripts to configure this user account. Do not close this window.' -PercentComplete $complete;
|
|
||||||
& $script;
|
|
||||||
$complete += $increment;
|
|
||||||
}
|
|
||||||
} *>&1 >> "$env:TEMP\UserOnce.log";
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\DefaultUser.ps1" transformation="Text">
|
|
||||||
$scripts = @(
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\WindowsCopilot" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Remove-ItemProperty -LiteralPath 'Registry::HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Run' -Name 'OneDriveSetup' -Force -ErrorAction 'Continue';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowTaskViewButton /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
$names = @(
|
|
||||||
'ContentDeliveryAllowed';
|
|
||||||
'FeatureManagementEnabled';
|
|
||||||
'OEMPreInstalledAppsEnabled';
|
|
||||||
'PreInstalledAppsEnabled';
|
|
||||||
'PreInstalledAppsEverEnabled';
|
|
||||||
'SilentInstalledAppsEnabled';
|
|
||||||
'SoftLandingEnabled';
|
|
||||||
'SubscribedContentEnabled';
|
|
||||||
'SubscribedContent-310093Enabled';
|
|
||||||
'SubscribedContent-338387Enabled';
|
|
||||||
'SubscribedContent-338388Enabled';
|
|
||||||
'SubscribedContent-338389Enabled';
|
|
||||||
'SubscribedContent-338393Enabled';
|
|
||||||
'SubscribedContent-353698Enabled';
|
|
||||||
'SystemPaneSuggestionsEnabled';
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach( $name in $names ) {
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v $name /t REG_DWORD /d 0 /f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarAl /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\Explorer" /v DisableSearchBoxSuggestions /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\DWM" /v ColorPrevalence /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "UnattendedSetup" /t REG_SZ /d "powershell.exe -NoProfile -Command \""Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\UserOnce.ps1' -Raw | Invoke-Expression;\""" /f;
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
& {
|
|
||||||
[float] $complete = 0;
|
|
||||||
[float] $increment = 100 / $scripts.Count;
|
|
||||||
foreach( $script in $scripts ) {
|
|
||||||
Write-Progress -Activity 'Running scripts to modify the default user’’s registry hive. Do not close this window.' -PercentComplete $complete;
|
|
||||||
& $script;
|
|
||||||
$complete += $increment;
|
|
||||||
}
|
|
||||||
} *>&1 >> "C:\Windows\Setup\Scripts\DefaultUser.log";
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\FirstLogon.ps1" transformation="Text">
|
|
||||||
$scripts = @(
|
|
||||||
{
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'AutoLogonCount' -Type 'DWord' -Force -Value 0;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
cmd.exe /c "rmdir C:\Windows.old";
|
|
||||||
};
|
|
||||||
{
|
|
||||||
C:\Windows\Setup\Scripts\unattend-01.cmd;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\unattend-02.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
C:\Windows\Setup\Scripts\unattend-03.cmd;
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
& {
|
|
||||||
[float] $complete = 0;
|
|
||||||
[float] $increment = 100 / $scripts.Count;
|
|
||||||
foreach( $script in $scripts ) {
|
|
||||||
Write-Progress -Activity 'Running scripts to finalize your Windows installation. Do not close this window.' -PercentComplete $complete;
|
|
||||||
& $script;
|
|
||||||
$complete += $increment;
|
|
||||||
}
|
|
||||||
} *>&1 >> "C:\Windows\Setup\Scripts\FirstLogon.log";
|
|
||||||
</File>
|
|
||||||
</Extensions>
|
|
||||||
</unattend>
|
|
||||||
@ -1,755 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
|
|
||||||
<!--https://schneegans.de/windows/unattend-generator/?LanguageMode=Unattended&UILanguage=en-US&Locale=en-US&Keyboard=00000409&GeoLocation=244&ProcessorArchitecture=amd64&BypassRequirementsCheck=true&BypassNetworkCheck=true&ComputerNameMode=Script&ComputerNameScript=return+Read-Host+-Prompt+%27Enter+computer+name%27%3B&CompactOsMode=Default&TimeZoneMode=Explicit&TimeZone=Central+Standard+Time&PartitionMode=Unattended&PartitionLayout=GPT&EspSize=600&RecoveryMode=Partition&RecoverySize=1500&WindowsEditionMode=Unattended&WindowsEdition=pro&UserAccountMode=Unattended&AccountName0=Tech&AccountPassword0=SandlotSlickBoat%2325&AccountGroup0=Administrators&AccountName1=&AccountName2=&AccountName3=&AccountName4=&AutoLogonMode=Own&PasswordExpirationMode=Unlimited&LockoutMode=Default&HideFiles=Hidden&TaskbarSearch=Icon&ShowFileExtensions=true&DisableWidgets=true&LeftTaskbar=true&DeleteTaskbarIcons=true&HideTaskViewButton=true&DisableBingResults=true&AllowPowerShellScripts=true&DisableAppSuggestions=true&PreventDeviceEncryption=true&HideEdgeFre=true&WifiMode=Unattended&WifiName=Tricounty&WifiAuthentication=WPA2PSK&WifiPassword=TCSEwifi19%21&ExpressSettings=DisableAll&KeysMode=Skip&ColorMode=Custom&SystemColorTheme=Light&AppsColorTheme=Light&AccentColor=%230078d4&WallpaperMode=Solid&WallpaperColor=%230978d3&Remove3DViewer=true&RemoveBingSearch=true&RemoveCalculator=true&RemoveCamera=true&RemoveClipchamp=true&RemoveClock=true&RemoveCopilot=true&RemoveCortana=true&RemoveDevHome=true&RemoveFamily=true&RemoveFeedbackHub=true&RemoveGetHelp=true&RemoveHandwriting=true&RemoveInternetExplorer=true&RemoveMailCalendar=true&RemoveMaps=true&RemoveMathInputPanel=true&RemoveMediaFeatures=true&RemoveMixedReality=true&RemoveZuneVideo=true&RemoveNews=true&RemoveOffice365=true&RemoveOneDrive=true&RemoveOneNote=true&RemoveOneSync=true&RemoveOpenSSHClient=true&RemoveOutlook=true&RemovePaint3D=true&RemovePeople=true&RemovePhotos=true&RemovePowerAutomate=true&RemovePowerShell2=true&RemovePowerShellISE=true&RemoveQuickAssist=true&RemoveRecall=true&RemoveRdpClient=true&RemoveSkype=true&RemoveSolitaire=true&RemoveSpeech=true&RemoveStepsRecorder=true&RemoveStickyNotes=true&RemoveTeams=true&RemoveGetStarted=true&RemoveToDo=true&RemoveVoiceRecorder=true&RemoveWallet=true&RemoveWeather=true&RemoveFaxAndScan=true&RemoveWindowsHello=true&RemoveWindowsMediaPlayer=true&RemoveZuneMusic=true&RemoveWordPad=true&RemoveXboxApps=true&RemoveYourPhone=true&StartTilesMode=Default&StartPinsMode=Empty&FirstLogonScript0=curl+-L+https%3A%2F%2Fgitea.tcse.us%2Ftricounty%2Ftcse-deploy%2Farchive%2Fmain.zip+%2D%2Doutput+C%3A%5CScripts.zip&FirstLogonScriptType0=Cmd&FirstLogonScript1=Expand-Archive+-Path+%27C%3A%5CScripts.zip%27+-DestinationPath+%27C%3A%5CScripts%27%0D%0ARemove-Item+-Path+%27C%3A%5CScripts.zip%27%0D%0AMove-Item+-Path+%27C%3A%5CScripts%5Ctcse-deploy%5C*%27+-Destination+%27C%3A%5CScripts%27%0D%0ARemove-Item+-Path+%27C%3A%5CScripts%5Ctcse-deploy%5C%27&FirstLogonScriptType1=Ps1&FirstLogonScript2=C%3A%5CScripts%5CTCSE-Computer-Deploy.bat&FirstLogonScriptType2=Cmd&WdacMode=Skip-->
|
|
||||||
<settings pass="offlineServicing"></settings>
|
|
||||||
<settings pass="windowsPE">
|
|
||||||
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<SetupUILanguage>
|
|
||||||
<UILanguage>en-US</UILanguage>
|
|
||||||
</SetupUILanguage>
|
|
||||||
<InputLocale>0409:00000409</InputLocale>
|
|
||||||
<SystemLocale>en-US</SystemLocale>
|
|
||||||
<UILanguage>en-US</UILanguage>
|
|
||||||
<UserLocale>en-US</UserLocale>
|
|
||||||
</component>
|
|
||||||
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<ImageInstall>
|
|
||||||
<OSImage>
|
|
||||||
<InstallTo>
|
|
||||||
<DiskID>0</DiskID>
|
|
||||||
<PartitionID>3</PartitionID>
|
|
||||||
</InstallTo>
|
|
||||||
</OSImage>
|
|
||||||
</ImageInstall>
|
|
||||||
<UserData>
|
|
||||||
<ProductKey>
|
|
||||||
<Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</Key>
|
|
||||||
</ProductKey>
|
|
||||||
<AcceptEula>true</AcceptEula>
|
|
||||||
</UserData>
|
|
||||||
<UseConfigurationSet>false</UseConfigurationSet>
|
|
||||||
<RunSynchronous>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>1</Order>
|
|
||||||
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo SELECT DISK=0&echo CLEAN&echo CONVERT GPT&echo CREATE PARTITION EFI SIZE=600&echo FORMAT QUICK FS=FAT32 LABEL="System"&echo CREATE PARTITION MSR SIZE=16)"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>2</Order>
|
|
||||||
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo CREATE PARTITION PRIMARY&echo SHRINK MINIMUM=1500&echo FORMAT QUICK FS=NTFS LABEL="Windows"&echo CREATE PARTITION PRIMARY&echo FORMAT QUICK FS=NTFS LABEL="Recovery")"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>3</Order>
|
|
||||||
<Path>cmd.exe /c ">>"X:\diskpart.txt" (echo SET ID="de94bba4-06d1-4d40-a16a-bfd50179d6ac"&echo GPT ATTRIBUTES=0x8000000000000001)"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>4</Order>
|
|
||||||
<Path>cmd.exe /c "diskpart.exe /s "X:\diskpart.txt" >>"X:\diskpart.log" || ( type "X:\diskpart.log" & echo diskpart encountered an error. & pause & exit /b 1 )"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>5</Order>
|
|
||||||
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>6</Order>
|
|
||||||
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>7</Order>
|
|
||||||
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
</RunSynchronous>
|
|
||||||
</component>
|
|
||||||
</settings>
|
|
||||||
<settings pass="generalize"></settings>
|
|
||||||
<settings pass="specialize">
|
|
||||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<ComputerName>TEMPNAME</ComputerName>
|
|
||||||
<TimeZone>Central Standard Time</TimeZone>
|
|
||||||
</component>
|
|
||||||
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<RunSynchronous>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>1</Order>
|
|
||||||
<Path>powershell.exe -NoProfile -Command "$xml = [xml]::new(); $xml.Load('C:\Windows\Panther\unattend.xml'); $sb = [scriptblock]::Create( $xml.unattend.Extensions.ExtractScript ); Invoke-Command -ScriptBlock $sb -ArgumentList $xml;"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>2</Order>
|
|
||||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\Specialize.ps1' -Raw | Invoke-Expression;"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>3</Order>
|
|
||||||
<Path>reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>4</Order>
|
|
||||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\DefaultUser.ps1' -Raw | Invoke-Expression;"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
<RunSynchronousCommand wcm:action="add">
|
|
||||||
<Order>5</Order>
|
|
||||||
<Path>reg.exe unload "HKU\DefaultUser"</Path>
|
|
||||||
</RunSynchronousCommand>
|
|
||||||
</RunSynchronous>
|
|
||||||
</component>
|
|
||||||
</settings>
|
|
||||||
<settings pass="auditSystem"></settings>
|
|
||||||
<settings pass="auditUser"></settings>
|
|
||||||
<settings pass="oobeSystem">
|
|
||||||
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<InputLocale>0409:00000409</InputLocale>
|
|
||||||
<SystemLocale>en-US</SystemLocale>
|
|
||||||
<UILanguage>en-US</UILanguage>
|
|
||||||
<UserLocale>en-US</UserLocale>
|
|
||||||
</component>
|
|
||||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
|
||||||
<UserAccounts>
|
|
||||||
<LocalAccounts>
|
|
||||||
<LocalAccount wcm:action="add">
|
|
||||||
<Name>Tech</Name>
|
|
||||||
<Group>Administrators</Group>
|
|
||||||
<Password>
|
|
||||||
<Value>SandlotSlickBoat#25</Value>
|
|
||||||
<PlainText>true</PlainText>
|
|
||||||
</Password>
|
|
||||||
</LocalAccount>
|
|
||||||
</LocalAccounts>
|
|
||||||
</UserAccounts>
|
|
||||||
<AutoLogon>
|
|
||||||
<Username>Tech</Username>
|
|
||||||
<Enabled>true</Enabled>
|
|
||||||
<LogonCount>1</LogonCount>
|
|
||||||
<Password>
|
|
||||||
<Value>SandlotSlickBoat#25</Value>
|
|
||||||
<PlainText>true</PlainText>
|
|
||||||
</Password>
|
|
||||||
</AutoLogon>
|
|
||||||
<OOBE>
|
|
||||||
<ProtectYourPC>3</ProtectYourPC>
|
|
||||||
<HideEULAPage>true</HideEULAPage>
|
|
||||||
<HideOnlineAccountScreens>false</HideOnlineAccountScreens>
|
|
||||||
</OOBE>
|
|
||||||
<FirstLogonCommands>
|
|
||||||
<SynchronousCommand wcm:action="add">
|
|
||||||
<Order>1</Order>
|
|
||||||
<CommandLine>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\FirstLogon.ps1' -Raw | Invoke-Expression;"</CommandLine>
|
|
||||||
</SynchronousCommand>
|
|
||||||
</FirstLogonCommands>
|
|
||||||
</component>
|
|
||||||
</settings>
|
|
||||||
<Extensions xmlns="https://schneegans.de/windows/unattend-generator/">
|
|
||||||
<ExtractScript>
|
|
||||||
param(
|
|
||||||
[xml] $Document
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach( $file in $Document.unattend.Extensions.File ) {
|
|
||||||
$path = [System.Environment]::ExpandEnvironmentVariables(
|
|
||||||
$file.GetAttribute( 'path' )
|
|
||||||
);
|
|
||||||
mkdir -Path( $path | Split-Path -Parent ) -ErrorAction 'SilentlyContinue';
|
|
||||||
$content = $file.InnerText.Trim();
|
|
||||||
if( $file.GetAttribute( 'transformation' ) -ieq 'Base64' ) {
|
|
||||||
[System.IO.File]::WriteAllBytes( $path, [System.Convert]::FromBase64String( $content ) );
|
|
||||||
} else {
|
|
||||||
$encoding = switch( [System.IO.Path]::GetExtension( $path ) ) {
|
|
||||||
{ $_ -in '.ps1', '.xml' } { [System.Text.Encoding]::UTF8; }
|
|
||||||
{ $_ -in '.reg', '.vbs', '.js' } { [System.Text.UnicodeEncoding]::new( $false, $true ); }
|
|
||||||
default { [System.Text.Encoding]::Default; }
|
|
||||||
};
|
|
||||||
[System.IO.File]::WriteAllBytes( $path, ( $encoding.GetPreamble() + $encoding.GetBytes( $content ) ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</ExtractScript>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\GetComputerName.ps1" transformation="Text">
|
|
||||||
return Read-Host -Prompt 'Enter computer name';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\SetComputerName.ps1" transformation="Text">
|
|
||||||
$ErrorActionPreference = 'Stop';
|
|
||||||
Set-StrictMode -Version 'Latest';
|
|
||||||
& {
|
|
||||||
$newName = ( Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\ComputerName.txt' -Raw ).Trim();
|
|
||||||
if( [string]::IsNullOrWhitespace( $newName ) ) {
|
|
||||||
throw "No computer name was provided.";
|
|
||||||
}
|
|
||||||
|
|
||||||
$keys = @(
|
|
||||||
@{
|
|
||||||
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName';
|
|
||||||
Name = 'ComputerName';
|
|
||||||
};
|
|
||||||
@{
|
|
||||||
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters';
|
|
||||||
Name = 'Hostname';
|
|
||||||
};
|
|
||||||
@{
|
|
||||||
LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters';
|
|
||||||
Name = 'NV Hostname';
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
while( $true ) {
|
|
||||||
foreach( $key in $keys ) {
|
|
||||||
Set-ItemProperty @key -Type 'String' -Value $newName;
|
|
||||||
}
|
|
||||||
Start-Sleep -Milliseconds 50;
|
|
||||||
}
|
|
||||||
} *>&1 >> 'C:\Windows\Setup\Scripts\SetComputerName.log';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\RemovePackages.ps1" transformation="Text">
|
|
||||||
$selectors = @(
|
|
||||||
'Microsoft.Microsoft3DViewer';
|
|
||||||
'Microsoft.BingSearch';
|
|
||||||
'Microsoft.WindowsCalculator';
|
|
||||||
'Microsoft.WindowsCamera';
|
|
||||||
'Clipchamp.Clipchamp';
|
|
||||||
'Microsoft.WindowsAlarms';
|
|
||||||
'Microsoft.549981C3F5F10';
|
|
||||||
'Microsoft.Windows.DevHome';
|
|
||||||
'MicrosoftCorporationII.MicrosoftFamily';
|
|
||||||
'Microsoft.WindowsFeedbackHub';
|
|
||||||
'Microsoft.GetHelp';
|
|
||||||
'Microsoft.Getstarted';
|
|
||||||
'microsoft.windowscommunicationsapps';
|
|
||||||
'Microsoft.WindowsMaps';
|
|
||||||
'Microsoft.MixedReality.Portal';
|
|
||||||
'Microsoft.BingNews';
|
|
||||||
'Microsoft.MicrosoftOfficeHub';
|
|
||||||
'Microsoft.Office.OneNote';
|
|
||||||
'Microsoft.OutlookForWindows';
|
|
||||||
'Microsoft.MSPaint';
|
|
||||||
'Microsoft.People';
|
|
||||||
'Microsoft.Windows.Photos';
|
|
||||||
'Microsoft.PowerAutomateDesktop';
|
|
||||||
'MicrosoftCorporationII.QuickAssist';
|
|
||||||
'Microsoft.SkypeApp';
|
|
||||||
'Microsoft.MicrosoftSolitaireCollection';
|
|
||||||
'Microsoft.MicrosoftStickyNotes';
|
|
||||||
'MicrosoftTeams';
|
|
||||||
'MSTeams';
|
|
||||||
'Microsoft.Todos';
|
|
||||||
'Microsoft.WindowsSoundRecorder';
|
|
||||||
'Microsoft.Wallet';
|
|
||||||
'Microsoft.BingWeather';
|
|
||||||
'Microsoft.Xbox.TCUI';
|
|
||||||
'Microsoft.XboxApp';
|
|
||||||
'Microsoft.XboxGameOverlay';
|
|
||||||
'Microsoft.XboxGamingOverlay';
|
|
||||||
'Microsoft.XboxIdentityProvider';
|
|
||||||
'Microsoft.XboxSpeechToTextOverlay';
|
|
||||||
'Microsoft.GamingApp';
|
|
||||||
'Microsoft.YourPhone';
|
|
||||||
'Microsoft.ZuneMusic';
|
|
||||||
'Microsoft.ZuneVideo';
|
|
||||||
);
|
|
||||||
$getCommand = {
|
|
||||||
Get-AppxProvisionedPackage -Online;
|
|
||||||
};
|
|
||||||
$filterCommand = {
|
|
||||||
$_.DisplayName -eq $selector;
|
|
||||||
};
|
|
||||||
$removeCommand = {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter( Mandatory, ValueFromPipeline )]
|
|
||||||
$InputObject
|
|
||||||
);
|
|
||||||
process {
|
|
||||||
$InputObject | Remove-AppxProvisionedPackage -AllUsers -Online -ErrorAction 'Continue';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$type = 'Package';
|
|
||||||
$logfile = 'C:\Windows\Setup\Scripts\RemovePackages.log';
|
|
||||||
& {
|
|
||||||
$installed = & $getCommand;
|
|
||||||
foreach( $selector in $selectors ) {
|
|
||||||
$result = [ordered] @{
|
|
||||||
Selector = $selector;
|
|
||||||
};
|
|
||||||
$found = $installed | Where-Object -FilterScript $filterCommand;
|
|
||||||
if( $found ) {
|
|
||||||
$result.Output = $found | & $removeCommand;
|
|
||||||
if( $? ) {
|
|
||||||
$result.Message = "$type removed.";
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not removed.";
|
|
||||||
$result.Error = $Error[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not installed.";
|
|
||||||
}
|
|
||||||
$result | ConvertTo-Json -Depth 3 -Compress;
|
|
||||||
}
|
|
||||||
} *>&1 >> $logfile;
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\RemoveCapabilities.ps1" transformation="Text">
|
|
||||||
$selectors = @(
|
|
||||||
'Print.Fax.Scan';
|
|
||||||
'Language.Handwriting';
|
|
||||||
'Browser.InternetExplorer';
|
|
||||||
'MathRecognizer';
|
|
||||||
'OneCoreUAP.OneSync';
|
|
||||||
'OpenSSH.Client';
|
|
||||||
'Microsoft.Windows.PowerShell.ISE';
|
|
||||||
'App.Support.QuickAssist';
|
|
||||||
'Language.Speech';
|
|
||||||
'Language.TextToSpeech';
|
|
||||||
'App.StepsRecorder';
|
|
||||||
'Hello.Face.18967';
|
|
||||||
'Hello.Face.Migration.18967';
|
|
||||||
'Hello.Face.20134';
|
|
||||||
'Media.WindowsMediaPlayer';
|
|
||||||
'Microsoft.Windows.WordPad';
|
|
||||||
);
|
|
||||||
$getCommand = {
|
|
||||||
Get-WindowsCapability -Online | Where-Object -Property 'State' -NotIn -Value @(
|
|
||||||
'NotPresent';
|
|
||||||
'Removed';
|
|
||||||
);
|
|
||||||
};
|
|
||||||
$filterCommand = {
|
|
||||||
($_.Name -split '~')[0] -eq $selector;
|
|
||||||
};
|
|
||||||
$removeCommand = {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter( Mandatory, ValueFromPipeline )]
|
|
||||||
$InputObject
|
|
||||||
);
|
|
||||||
process {
|
|
||||||
$InputObject | Remove-WindowsCapability -Online -ErrorAction 'Continue';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$type = 'Capability';
|
|
||||||
$logfile = 'C:\Windows\Setup\Scripts\RemoveCapabilities.log';
|
|
||||||
& {
|
|
||||||
$installed = & $getCommand;
|
|
||||||
foreach( $selector in $selectors ) {
|
|
||||||
$result = [ordered] @{
|
|
||||||
Selector = $selector;
|
|
||||||
};
|
|
||||||
$found = $installed | Where-Object -FilterScript $filterCommand;
|
|
||||||
if( $found ) {
|
|
||||||
$result.Output = $found | & $removeCommand;
|
|
||||||
if( $? ) {
|
|
||||||
$result.Message = "$type removed.";
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not removed.";
|
|
||||||
$result.Error = $Error[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not installed.";
|
|
||||||
}
|
|
||||||
$result | ConvertTo-Json -Depth 3 -Compress;
|
|
||||||
}
|
|
||||||
} *>&1 >> $logfile;
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\RemoveFeatures.ps1" transformation="Text">
|
|
||||||
$selectors = @(
|
|
||||||
'MediaPlayback';
|
|
||||||
'MicrosoftWindowsPowerShellV2Root';
|
|
||||||
'Microsoft-RemoteDesktopConnection';
|
|
||||||
'Recall';
|
|
||||||
);
|
|
||||||
$getCommand = {
|
|
||||||
Get-WindowsOptionalFeature -Online | Where-Object -Property 'State' -NotIn -Value @(
|
|
||||||
'Disabled';
|
|
||||||
'DisabledWithPayloadRemoved';
|
|
||||||
);
|
|
||||||
};
|
|
||||||
$filterCommand = {
|
|
||||||
$_.FeatureName -eq $selector;
|
|
||||||
};
|
|
||||||
$removeCommand = {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter( Mandatory, ValueFromPipeline )]
|
|
||||||
$InputObject
|
|
||||||
);
|
|
||||||
process {
|
|
||||||
$InputObject | Disable-WindowsOptionalFeature -Online -Remove -NoRestart -ErrorAction 'Continue';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$type = 'Feature';
|
|
||||||
$logfile = 'C:\Windows\Setup\Scripts\RemoveFeatures.log';
|
|
||||||
& {
|
|
||||||
$installed = & $getCommand;
|
|
||||||
foreach( $selector in $selectors ) {
|
|
||||||
$result = [ordered] @{
|
|
||||||
Selector = $selector;
|
|
||||||
};
|
|
||||||
$found = $installed | Where-Object -FilterScript $filterCommand;
|
|
||||||
if( $found ) {
|
|
||||||
$result.Output = $found | & $removeCommand;
|
|
||||||
if( $? ) {
|
|
||||||
$result.Message = "$type removed.";
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not removed.";
|
|
||||||
$result.Error = $Error[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result.Message = "$type not installed.";
|
|
||||||
}
|
|
||||||
$result | ConvertTo-Json -Depth 3 -Compress;
|
|
||||||
}
|
|
||||||
} *>&1 >> $logfile;
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\Wifi.xml" transformation="Text">
|
|
||||||
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
|
|
||||||
<name>Tricounty</name>
|
|
||||||
<SSIDConfig>
|
|
||||||
<SSID>
|
|
||||||
<hex>547269636F756E7479</hex>
|
|
||||||
<name>Tricounty</name>
|
|
||||||
</SSID>
|
|
||||||
</SSIDConfig>
|
|
||||||
<connectionType>ESS</connectionType>
|
|
||||||
<connectionMode>auto</connectionMode>
|
|
||||||
<MSM>
|
|
||||||
<security>
|
|
||||||
<authEncryption>
|
|
||||||
<authentication>WPA2PSK</authentication>
|
|
||||||
<encryption>AES</encryption>
|
|
||||||
<useOneX>false</useOneX>
|
|
||||||
</authEncryption>
|
|
||||||
<sharedKey>
|
|
||||||
<keyType>passPhrase</keyType>
|
|
||||||
<protected>false</protected>
|
|
||||||
<keyMaterial>TCSEwifi19!</keyMaterial>
|
|
||||||
</sharedKey>
|
|
||||||
</security>
|
|
||||||
</MSM>
|
|
||||||
</WLANProfile>
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\TaskbarIcons.ps1" transformation="Text">
|
|
||||||
Remove-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband' -Name '*';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\SetStartPins.ps1" transformation="Text">
|
|
||||||
$json = '{"pinnedList":[]}';
|
|
||||||
if( [System.Environment]::OSVersion.Version.Build -lt 20000 ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$key = 'Registry::HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start';
|
|
||||||
New-Item -Path $key -ItemType 'Directory' -ErrorAction 'SilentlyContinue';
|
|
||||||
Set-ItemProperty -LiteralPath $key -Name 'ConfigureStartPins' -Value $json -Type 'String';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\SetColorTheme.ps1" transformation="Text">
|
|
||||||
$lightThemeSystem = 1;
|
|
||||||
$lightThemeApps = 1;
|
|
||||||
$accentColorOnStart = 0;
|
|
||||||
$enableTransparency = 0;
|
|
||||||
$htmlAccentColor = '#0078D4';
|
|
||||||
& {
|
|
||||||
$params = @{
|
|
||||||
LiteralPath = 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize';
|
|
||||||
Force = $true;
|
|
||||||
Type = 'DWord';
|
|
||||||
};
|
|
||||||
Set-ItemProperty @params -Name 'SystemUsesLightTheme' -Value $lightThemeSystem;
|
|
||||||
Set-ItemProperty @params -Name 'AppsUseLightTheme' -Value $lightThemeApps;
|
|
||||||
Set-ItemProperty @params -Name 'ColorPrevalence' -Value $accentColorOnStart;
|
|
||||||
Set-ItemProperty @params -Name 'EnableTransparency' -Value $enableTransparency;
|
|
||||||
};
|
|
||||||
& {
|
|
||||||
Add-Type -AssemblyName 'System.Drawing';
|
|
||||||
$accentColor = [System.Drawing.ColorTranslator]::FromHtml( $htmlAccentColor );
|
|
||||||
|
|
||||||
function ConvertTo-DWord {
|
|
||||||
param(
|
|
||||||
[System.Drawing.Color]
|
|
||||||
$Color
|
|
||||||
);
|
|
||||||
|
|
||||||
[byte[]] $bytes = @(
|
|
||||||
$Color.R;
|
|
||||||
$Color.G;
|
|
||||||
$Color.B;
|
|
||||||
$Color.A;
|
|
||||||
);
|
|
||||||
return [System.BitConverter]::ToUInt32( $bytes, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
$startColor = [System.Drawing.Color]::FromArgb( 0xD2, $accentColor );
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name 'StartColorMenu' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name 'AccentColorMenu' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\DWM' -Name 'AccentColor' -Value( ConvertTo-DWord -Color $accentColor ) -Type 'DWord' -Force;
|
|
||||||
$params = @{
|
|
||||||
LiteralPath = 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent';
|
|
||||||
Name = 'AccentPalette';
|
|
||||||
};
|
|
||||||
$palette = Get-ItemPropertyValue @params;
|
|
||||||
$index = 20;
|
|
||||||
$palette[ $index++ ] = $accentColor.R;
|
|
||||||
$palette[ $index++ ] = $accentColor.G;
|
|
||||||
$palette[ $index++ ] = $accentColor.B;
|
|
||||||
$palette[ $index++ ] = $accentColor.A;
|
|
||||||
Set-ItemProperty @params -Value $palette -Type 'Binary' -Force;
|
|
||||||
};
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\SetWallpaper.ps1" transformation="Text">
|
|
||||||
Add-Type -TypeDefinition '
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
public static class WallpaperSetter {
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern bool SetSysColors(
|
|
||||||
int cElements,
|
|
||||||
int[] lpaElements,
|
|
||||||
int[] lpaRgbValues
|
|
||||||
);
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern bool SystemParametersInfo(
|
|
||||||
uint uiAction,
|
|
||||||
uint uiParam,
|
|
||||||
string pvParam,
|
|
||||||
uint fWinIni
|
|
||||||
);
|
|
||||||
|
|
||||||
public static void SetDesktopBackground(Color color) {
|
|
||||||
SystemParametersInfo(20, 0, "", 0);
|
|
||||||
SetSysColors(1, new int[] { 1 }, new int[] { ColorTranslator.ToWin32(color) });
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetDesktopImage(string file) {
|
|
||||||
SystemParametersInfo(20, 0, file, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
' -ReferencedAssemblies 'System.Drawing';
|
|
||||||
|
|
||||||
function Set-WallpaperColor {
|
|
||||||
param(
|
|
||||||
[string]
|
|
||||||
$HtmlColor
|
|
||||||
);
|
|
||||||
|
|
||||||
$color = [System.Drawing.ColorTranslator]::FromHtml( $HtmlColor );
|
|
||||||
[WallpaperSetter]::SetDesktopBackground( $color );
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers' -Name 'BackgroundType' -Type 'DWord' -Value 1 -Force;
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Desktop' -Name 'WallPaper' -Type 'String' -Value '' -Force;
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Colors' -Name 'Background' -Type 'String' -Value "$($color.R) $($color.G) $($color.B)" -Force;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Set-WallpaperImage {
|
|
||||||
param(
|
|
||||||
[string]
|
|
||||||
$LiteralPath
|
|
||||||
);
|
|
||||||
|
|
||||||
[WallpaperSetter]::SetDesktopImage( $LiteralPath );
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers' -Name 'BackgroundType' -Type 'DWord' -Value 0 -Force;
|
|
||||||
Set-ItemProperty -Path 'Registry::HKCU\Control Panel\Desktop' -Name 'WallPaper' -Type 'String' -Value $LiteralPath -Force;
|
|
||||||
}
|
|
||||||
Set-WallpaperColor -HtmlColor '#0978D3';
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\unattend-01.cmd" transformation="Text">
|
|
||||||
curl -L https://gitea.tcse.us/tricounty/tcse-deploy/archive/main.zip --output C:\Scripts.zip
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\unattend-02.ps1" transformation="Text">
|
|
||||||
Expand-Archive -Path 'C:\Scripts.zip' -DestinationPath 'C:\Scripts'
|
|
||||||
Remove-Item -Path 'C:\Scripts.zip'
|
|
||||||
Move-Item -Path 'C:\Scripts\tcse-deploy\*' -Destination 'C:\Scripts'
|
|
||||||
Remove-Item -Path 'C:\Scripts\tcse-deploy\'
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\unattend-03.cmd" transformation="Text">
|
|
||||||
C:\Scripts\TCSE-Computer-Deploy.bat
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\Specialize.ps1" transformation="Text">
|
|
||||||
$scripts = @(
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\GetComputerName.ps1' -Raw | Invoke-Expression > 'C:\Windows\Setup\Scripts\ComputerName.txt';
|
|
||||||
Start-Process -FilePath ( Get-Process -Id $PID ).Path -ArgumentList '-NoProfile', '-Command', 'Get-Content -LiteralPath "C:\Windows\Setup\Scripts\SetComputerName.ps1" -Raw | Invoke-Expression;' -WindowStyle 'Hidden';
|
|
||||||
Start-Sleep -Seconds 10;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v BypassNRO /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate' -Force -ErrorAction 'SilentlyContinue';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Remove-Item -LiteralPath 'C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk', 'C:\Windows\System32\OneDriveSetup.exe', 'C:\Windows\SysWOW64\OneDriveSetup.exe' -ErrorAction 'Continue';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Remove-Item -LiteralPath 'Registry::HKLM\Software\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' -Force -ErrorAction 'SilentlyContinue';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v ConfigureChatAutoInstall /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemovePackages.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemoveCapabilities.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\RemoveFeatures.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
netsh.exe wlan add profile filename="C:\Windows\Setup\Scripts\Wifi.xml" user=all;
|
|
||||||
Remove-Item -LiteralPath 'C:\Windows\Setup\Scripts\Wifi.xml';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
netsh.exe wlan connect name="Tricounty" ssid="Tricounty";
|
|
||||||
};
|
|
||||||
{
|
|
||||||
net.exe accounts /maxpwage:UNLIMITED;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Set-ExecutionPolicy -Scope 'LocalMachine' -ExecutionPolicy 'RemoteSigned' -Force;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v HideFirstRunExperience /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetStartPins.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
& {
|
|
||||||
[float] $complete = 0;
|
|
||||||
[float] $increment = 100 / $scripts.Count;
|
|
||||||
foreach( $script in $scripts ) {
|
|
||||||
Write-Progress -Activity 'Running scripts to customize your Windows installation. Do not close this window.' -PercentComplete $complete;
|
|
||||||
& $script;
|
|
||||||
$complete += $increment;
|
|
||||||
}
|
|
||||||
} *>&1 >> "C:\Windows\Setup\Scripts\Specialize.log";
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\UserOnce.ps1" transformation="Text">
|
|
||||||
$scripts = @(
|
|
||||||
{
|
|
||||||
Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\TaskbarIcons.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Search' -Name 'SearchboxTaskbarMode' -Type 'DWord' -Value 1;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetColorTheme.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\SetWallpaper.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Process -Name 'explorer' -ErrorAction 'SilentlyContinue' | Where-Object -FilterScript {
|
|
||||||
$_.SessionId -eq ( Get-Process -Id $PID ).SessionId;
|
|
||||||
} | Stop-Process -Force;
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
& {
|
|
||||||
[float] $complete = 0;
|
|
||||||
[float] $increment = 100 / $scripts.Count;
|
|
||||||
foreach( $script in $scripts ) {
|
|
||||||
Write-Progress -Activity 'Running scripts to configure this user account. Do not close this window.' -PercentComplete $complete;
|
|
||||||
& $script;
|
|
||||||
$complete += $increment;
|
|
||||||
}
|
|
||||||
} *>&1 >> "$env:TEMP\UserOnce.log";
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\DefaultUser.ps1" transformation="Text">
|
|
||||||
$scripts = @(
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\WindowsCopilot" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Remove-ItemProperty -LiteralPath 'Registry::HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Run' -Name 'OneDriveSetup' -Force -ErrorAction 'Continue';
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowTaskViewButton /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
$names = @(
|
|
||||||
'ContentDeliveryAllowed';
|
|
||||||
'FeatureManagementEnabled';
|
|
||||||
'OEMPreInstalledAppsEnabled';
|
|
||||||
'PreInstalledAppsEnabled';
|
|
||||||
'PreInstalledAppsEverEnabled';
|
|
||||||
'SilentInstalledAppsEnabled';
|
|
||||||
'SoftLandingEnabled';
|
|
||||||
'SubscribedContentEnabled';
|
|
||||||
'SubscribedContent-310093Enabled';
|
|
||||||
'SubscribedContent-338387Enabled';
|
|
||||||
'SubscribedContent-338388Enabled';
|
|
||||||
'SubscribedContent-338389Enabled';
|
|
||||||
'SubscribedContent-338393Enabled';
|
|
||||||
'SubscribedContent-353698Enabled';
|
|
||||||
'SystemPaneSuggestionsEnabled';
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach( $name in $names ) {
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v $name /t REG_DWORD /d 0 /f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarAl /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\Explorer" /v DisableSearchBoxSuggestions /t REG_DWORD /d 1 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\DWM" /v ColorPrevalence /t REG_DWORD /d 0 /f;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "UnattendedSetup" /t REG_SZ /d "powershell.exe -NoProfile -Command \""Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\UserOnce.ps1' -Raw | Invoke-Expression;\""" /f;
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
& {
|
|
||||||
[float] $complete = 0;
|
|
||||||
[float] $increment = 100 / $scripts.Count;
|
|
||||||
foreach( $script in $scripts ) {
|
|
||||||
Write-Progress -Activity 'Running scripts to modify the default user’’s registry hive. Do not close this window.' -PercentComplete $complete;
|
|
||||||
& $script;
|
|
||||||
$complete += $increment;
|
|
||||||
}
|
|
||||||
} *>&1 >> "C:\Windows\Setup\Scripts\DefaultUser.log";
|
|
||||||
</File>
|
|
||||||
<File path="C:\Windows\Setup\Scripts\FirstLogon.ps1" transformation="Text">
|
|
||||||
$scripts = @(
|
|
||||||
{
|
|
||||||
Set-ItemProperty -LiteralPath 'Registry::HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'AutoLogonCount' -Type 'DWord' -Force -Value 0;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
cmd.exe /c "rmdir C:\Windows.old";
|
|
||||||
};
|
|
||||||
{
|
|
||||||
C:\Windows\Setup\Scripts\unattend-01.cmd;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\unattend-02.ps1' -Raw | Invoke-Expression;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
C:\Windows\Setup\Scripts\unattend-03.cmd;
|
|
||||||
};
|
|
||||||
);
|
|
||||||
|
|
||||||
& {
|
|
||||||
[float] $complete = 0;
|
|
||||||
[float] $increment = 100 / $scripts.Count;
|
|
||||||
foreach( $script in $scripts ) {
|
|
||||||
Write-Progress -Activity 'Running scripts to finalize your Windows installation. Do not close this window.' -PercentComplete $complete;
|
|
||||||
& $script;
|
|
||||||
$complete += $increment;
|
|
||||||
}
|
|
||||||
} *>&1 >> "C:\Windows\Setup\Scripts\FirstLogon.log";
|
|
||||||
</File>
|
|
||||||
</Extensions>
|
|
||||||
</unattend>
|
|
||||||
24
Login/Launch-GoogleDrive.ps1
Normal file
24
Login/Launch-GoogleDrive.ps1
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Launch Google Drive for Desktop
|
||||||
|
$logFile = "%TEMP%\googledrive-launch.log"
|
||||||
|
|
||||||
|
# Check if Google Drive File Stream is already set to launch on startup
|
||||||
|
$startupKey = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
|
||||||
|
$driveKey = "GoogleDriveFS"
|
||||||
|
|
||||||
|
try {
|
||||||
|
$existingValue = Get-ItemProperty -Path $startupKey -Name $driveKey -ErrorAction Stop
|
||||||
|
Add-Content -Path $logFile -Value "Google Drive File Stream is already set to launch on startup."
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
# Key doesn't exist, so launch Google Drive
|
||||||
|
Add-Content -Path $logFile -Value "Launching Google Drive for Desktop..."
|
||||||
|
|
||||||
|
# Path to Google Drive launch executable
|
||||||
|
$driveLaunchPath = "C:\Program Files\Google\Drive File Stream\launch.bat"
|
||||||
|
|
||||||
|
# Start Google Drive
|
||||||
|
Start-Process -FilePath $driveLaunchPath -WindowStyle Hidden
|
||||||
|
|
||||||
|
# Wait for Google Drive to launch
|
||||||
|
Start-Sleep -Seconds 5
|
||||||
|
}
|
||||||
37
Patches/Windows/Enable-WOL.ps1
Normal file
37
Patches/Windows/Enable-WOL.ps1
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Get all physical network adapters and their WOL-related properties
|
||||||
|
$wolStatus = Get-NetAdapter -Physical | Get-NetAdapterAdvancedProperty | Where-Object {
|
||||||
|
($_.DisplayName -like '*WOL*') -or ($_.DisplayName -like '*Wake*')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check if WOL is disabled for any adapter
|
||||||
|
function Test-WolDisabled {
|
||||||
|
param($wolProperties)
|
||||||
|
|
||||||
|
foreach ($property in $wolProperties) {
|
||||||
|
# Check if the property is disabled or set to 0
|
||||||
|
if ($property.DisplayValue -eq 'Disabled' -or $property.DisplayValue -eq '0') {
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get all physical adapters for reference
|
||||||
|
$physicalAdapters = Get-NetAdapter -Physical
|
||||||
|
|
||||||
|
# Check if WOL is disabled on any adapter
|
||||||
|
if (Test-WolDisabled -wolProperties $wolStatus) {
|
||||||
|
Write-Host "Wake on Magic Packet is disabled on one or more adapters. Enabling..."
|
||||||
|
|
||||||
|
# Enable WOL features for all physical adapters
|
||||||
|
try {
|
||||||
|
$physicalAdapters | Set-NetAdapterPowerManagement -WakeOnMagicPacket Enabled -WakeOnPattern Enabled
|
||||||
|
Write-Host "Successfully enabled Wake on Magic Packet for all physical adapters." -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "Error enabling Wake on Magic Packet: $($_.Exception.Message)" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Wake on Magic Packet is already enabled on all adapters." -ForegroundColor Green
|
||||||
|
}
|
||||||
3
Patches/Windows/Update-TCSE-Deploy.bat
Normal file
3
Patches/Windows/Update-TCSE-Deploy.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
:: Download TCSE Deploy Archive
|
||||||
|
curl -L https://gitea.tcse.us/tricounty/tcse-deploy/raw/branch/main/TCSE-Login.bat --output C:\Scripts\TCSE-Login.bat
|
||||||
|
|
||||||
@ -42,6 +42,8 @@ winget install --exact --id VideoLAN.VLC --silent
|
|||||||
|
|
||||||
:: Install ImageGlass Image Viewer
|
:: Install ImageGlass Image Viewer
|
||||||
echo Installing ImageGlass...
|
echo Installing ImageGlass...
|
||||||
|
winget install --exact --id Microsoft.DotNet.DesktopRuntime.8
|
||||||
|
winget install --exact --id Microsoft.EdgeWebView2Runtime
|
||||||
winget install --exact --id DuongDieuPhap.ImageGlass --silent
|
winget install --exact --id DuongDieuPhap.ImageGlass --silent
|
||||||
powershell Copy-Item 'C:\Scripts\Patches\ImageGlass\igconfig.admin.json' 'C:\Program Files\ImageGlass'
|
powershell Copy-Item 'C:\Scripts\Patches\ImageGlass\igconfig.admin.json' 'C:\Program Files\ImageGlass'
|
||||||
|
|
||||||
@ -79,11 +81,22 @@ echo Adding Group Policy to All Users...
|
|||||||
C:\Scripts\Patches\GroupPolicy\LGPO.exe /g C:\Scripts\Patches\GroupPolicy\
|
C:\Scripts\Patches\GroupPolicy\LGPO.exe /g C:\Scripts\Patches\GroupPolicy\
|
||||||
echo Successfully Applied Policy...
|
echo Successfully Applied Policy...
|
||||||
|
|
||||||
|
:: Enable Wake on LAN
|
||||||
|
echo Checking Wake on LAN...
|
||||||
|
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Enable-WOL.ps1"
|
||||||
|
|
||||||
:: Copy Login Scripts to User Startup
|
:: Copy Login Scripts to User Startup
|
||||||
echo Copying Login Scripts to All Users...
|
echo Copying Login Scripts to All Users...
|
||||||
powershell Copy-Item 'C:\Scripts\TCSE-Login.vbs' 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup'
|
powershell Copy-Item 'C:\Scripts\TCSE-Login.vbs' 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup'
|
||||||
echo Successfully Copied Login Scripts...
|
echo Successfully Copied Login Scripts...
|
||||||
|
|
||||||
|
:: Remove Leftovers
|
||||||
|
powershell Remove-Item -Path 'C:\Scripts\tcse-deploy' -Recurse -Force
|
||||||
|
powershell Remove-Item -Path 'C:\Scripts.zip'
|
||||||
|
powershell Remove-Item -Path 'C:\Scripts\Software\Office2016' -Recurse -Force
|
||||||
|
powershell Remove-Item -Path 'C:\Scripts\Software\RemoteAgent64-TCSE.exe'
|
||||||
|
powershell Remove-Item -Path 'C:\Scripts\Software\gcpwstandaloneenterprise64.exe'
|
||||||
|
|
||||||
:: Perform Windows Updates
|
:: Perform Windows Updates
|
||||||
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Initial-Windows-Updates.ps1"
|
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Initial-Windows-Updates.ps1"
|
||||||
|
|
||||||
|
|||||||
@ -42,17 +42,8 @@ echo Remove Edge Desktop Shortcut... >> "%LOGFILE%"
|
|||||||
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Remove-EdgeShortcut.ps1"
|
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Remove-EdgeShortcut.ps1"
|
||||||
|
|
||||||
:: Launch Google Drive for Desktop
|
:: Launch Google Drive for Desktop
|
||||||
:: Check if Google Drive File Stream is already set to launch on startup
|
echo Launching Google Drive... >> "%LOGFILE%"
|
||||||
reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "GoogleDriveFS" >nul 2>&1
|
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Launch-GoogleDrive.ps1"
|
||||||
if %errorlevel% equ 0 (
|
|
||||||
echo Google Drive File Stream is already set to launch on startup. >> "%LOGFILE%"
|
|
||||||
) else (
|
|
||||||
echo Launching Google Drive for Desktop... >> "%LOGFILE%"
|
|
||||||
start /B "" "C:\Program Files\Google\Drive File Stream\launch.bat"
|
|
||||||
|
|
||||||
:: Wait for Google Drive to launch
|
|
||||||
timeout /t 5 /nobreak > nul
|
|
||||||
)
|
|
||||||
|
|
||||||
:: Uninstall OneDrive
|
:: Uninstall OneDrive
|
||||||
echo Uninstall OneDrive... >> "%LOGFILE%"
|
echo Uninstall OneDrive... >> "%LOGFILE%"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user