From 7e86eea6ca0e25cc4d37cefebe900ce826eff9f6 Mon Sep 17 00:00:00 2001 From: James Stringer <38541878+jamesstringerparsec@users.noreply.github.com> Date: Tue, 12 Oct 2021 08:03:50 -0700 Subject: [PATCH] Improvements --- CopyFilesToVM.ps1 | 32 ++++---------------- autounattend.xml | 74 +++++++++++++++++++++++++---------------------- gpt.ini | 4 +-- psscripts.ini | 4 +-- 4 files changed, 50 insertions(+), 64 deletions(-) diff --git a/CopyFilesToVM.ps1 b/CopyFilesToVM.ps1 index b59d345..eea124b 100644 --- a/CopyFilesToVM.ps1 +++ b/CopyFilesToVM.ps1 @@ -1,37 +1,17 @@ -function add-gpo-modifications { -param( -[string]$DriveLetter -) - $querygpt = Get-content $DriveLetter\Windows\System32\GroupPolicy\gpt.ini - $matchgpt = $querygpt -match '{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}' - if ($matchgpt -contains "*0000F87571E3*" -eq $false) { - $gptstring = get-content $DriveLetter\Windows\System32\GroupPolicy\gpt.ini - $gpoversion = $gptstring -match "Version" - $GPO = $gptstring -match "gPCMachineExtensionNames" - $add = '[{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}]' - $replace = "$GPO" + "$add" - (Get-Content "$DriveLetter\Windows\System32\GroupPolicy\gpt.ini").Replace("$GPO","$replace") | Set-Content "$DriveLetter\Windows\System32\GroupPolicy\gpt.ini" - [int]$i = $gpoversion.trim("Version=") - [int]$n = $gpoversion.trim("Version=") - $n +=2 - (Get-Content $DriveLetter\Windows\System32\GroupPolicy\gpt.ini) -replace "Version=$i", "Version=$n" | Set-Content $DriveLetter\Windows\System32\GroupPolicy\gpt.ini - } - else{ - write-output "Not Required" - } - } + Function Setup-ParsecInstall { param( [string]$DriveLetter ) - add-gpo-modifications -DriveLetter $DriveLetter + if((Test-Path -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Startup) -eq $true) {} Else {New-Item -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Startup -ItemType directory | Out-Null} if((Test-Path -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Shutdown) -eq $true) {} Else {New-Item -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Shutdown -ItemType directory | Out-Null} if((Test-Path -Path $DriveLetter\ProgramData\Easy-GPU-P) -eq $true) {} Else {New-Item -Path $DriveLetter\ProgramData\Easy-GPU-P -ItemType directory | Out-Null} - Move-Item -Path $psscriptroot\psscripts.ini -Destination $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts - Move-Item -Path $psscriptroot\Install.ps1 -Destination $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Startup - Move-Item -Path $psscriptroot\parsecpublic.cer -Destination $DriveLetter\ProgramData\Easy-GPU-P + Copy-Item -Path $psscriptroot\gpt.ini -Destination $DriveLetter\Windows\system32\GroupPolicy + Copy-Item -Path $psscriptroot\psscripts.ini -Destination $DriveLetter\Windows\system32\GroupPolicy\User\Scripts + Copy-Item -Path $psscriptroot\Install.ps1 -Destination $DriveLetter\Windows\system32\GroupPolicy\User\Scripts\Logon + Copy-Item -Path $psscriptroot\parsecpublic.cer -Destination $DriveLetter\ProgramData\Easy-GPU-P } diff --git a/autounattend.xml b/autounattend.xml index 22add2b..6d21a80 100644 --- a/autounattend.xml +++ b/autounattend.xml @@ -4,7 +4,7 @@ Created using Windows AFG found at: ;http://www.windowsafg.com Installation Notes -Location: United States +Location: Notes: Enter your comments here... **************************************************--> @@ -19,7 +19,7 @@ Notes: Enter your comments here... en-US en-US en-US -en-US +en-AU @@ -77,7 +77,7 @@ Notes: Enter your comments here... 4 4 - + C NTFS @@ -119,45 +119,31 @@ Notes: Enter your comments here... 0409:00000409 -en-US -en-US -en-US -en-US +en-AU +en-AU +en-AU +en-AU true -1 +0 -GPU-P +-PC W269N-WFGWX-YVC9B-4J6C9-T83GX - - - - - CoolPassword!:) - true</PlainText> - </Password> - <Description>Test account</Description> - <DisplayName>GPU-P</DisplayName> - <Group>Administrators</Group> - <Name>GPU-P</Name> - </LocalAccount> - </LocalAccounts> -</UserAccounts> <AutoLogon> <Password> <Value>CoolPassword!:)</Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> -<Username>GPUP</Username> +<Username>GPU-P</Username> </AutoLogon> <OOBE> <HideEULAPage>true</HideEULAPage> @@ -169,30 +155,50 @@ Notes: Enter your comments here... <SkipMachineOOBE>true</SkipMachineOOBE> <ProtectYourPC>1</ProtectYourPC> </OOBE> +<UserAccounts> +<LocalAccounts> +<LocalAccount wcm:action="add"> +<Password> +<Value>CoolPassword!:)</Value> +<PlainText>true</PlainText> +</Password> +<Description></Description> +<DisplayName>GPU-P</DisplayName> +<Group>Administrators</Group> +<Name>GPU-P</Name> +</LocalAccount> +</LocalAccounts> +</UserAccounts> <RegisteredOrganization></RegisteredOrganization> <RegisteredOwner>GPU-P</RegisteredOwner> <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> -<Description>Control Panel View</Description> +<Description>Allow Scripts</Description> <Order>1</Order> -<CommandLine>reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" /v StartupPage /t REG_DWORD /d 0 /f</CommandLine> -<RequiresUserInput>true</RequiresUserInput> -</SynchronousCommand> -<SynchronousCommand wcm:action="add"> -<Order>2</Order> -<Description>Control Panel Icon Size</Description> +<CommandLine>reg add HKLM\Software\Policies\Microsoft\Windows\Powershell</CommandLine> <RequiresUserInput>false</RequiresUserInput> -<CommandLine>reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" /v AllItemsIconView /t REG_DWORD /d 0 /f</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> +<Description>Allow Scripts</Description> +<Order>2</Order> +<CommandLine>reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v ExecutionPolicy /t REG_MULTI_SZ /d Unrestricted</commandline> +<RequiresUserInput>false</RequiresUserInput> +</SynchronousCommand> +<SynchronousCommand wcm:action="add"> +<Description>Allow Scripts</Description> <Order>3</Order> +<CommandLine>reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v EnableScripts /t REG_DWORD /d 1</commandline> +<RequiresUserInput>false</RequiresUserInput> +</SynchronousCommand> +<SynchronousCommand wcm:action="add"> +<Order>4</Order> <RequiresUserInput>false</RequiresUserInput> <CommandLine>cmd /C wmic useraccount where name="GPU-P" set PasswordExpires=false</CommandLine> <Description>Password Never Expires</Description> </SynchronousCommand> </FirstLogonCommands> -<TimeZone>Eastern Standard Time</TimeZone> +<TimeZone>GTB Standard Time</TimeZone> </component> </settings> -</unattend> +</unattend> \ No newline at end of file diff --git a/gpt.ini b/gpt.ini index 4e41c3c..01c6ad7 100644 --- a/gpt.ini +++ b/gpt.ini @@ -1,3 +1,3 @@ [General] -gPCMachineExtensionNames=[{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}] -Version=4 \ No newline at end of file +gPCUserExtensionNames=[{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B66650-4972-11D1-A7CA-0000F87571E3}] +Version=131072 \ No newline at end of file diff --git a/psscripts.ini b/psscripts.ini index 25e56e3..52d1a45 100644 --- a/psscripts.ini +++ b/psscripts.ini @@ -1,4 +1,4 @@ -[Startup] -0CmdLine=c:\Windows\system32\GroupPolicy\Machine\Scripts\Startup\Install.ps1 +[Logon] +0CmdLine=Install.ps1 0Parameters= \ No newline at end of file