From ca328d118c164b5cc1ee26fe6c27035da301ea72 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 15 Jul 2021 15:28:03 +0200 Subject: [PATCH] InitalCommit --- .gitignore | 1 + DeployTools/Deploy-FirstBoot.ps1 | 53 ++++++++++++++++++ DeployTools/Enable_Deploy-FirstBoot.cmd | 21 +++++++ .../INK_KickStart_Deploy-FirstBoot.lnk | Bin 0 -> 1770 bytes DeployTools/KickStart_Deploy-FirstBoot.cmd | 13 +++++ InstallTools/Choco-PKGS.list | 1 + InstallTools/Download-OandO-Tools.cmd | 15 +++++ InstallTools/Install-Chocolatey.cmd | 21 +++++++ InstallTools/Install-From-Choco-PKGSlist.cmd | 24 ++++++++ .../Remove-AdobeNotificationClient.cmd | 20 +++++++ ManagmentTools/KickStart_RunUpdates.cmd | 13 +++++ .../RunUpdates for Apps & System.lnk | Bin 0 -> 1811 bytes ManagmentTools/RunUpdates.ps1 | 28 +++++++++ ReadMe.md | 4 ++ 14 files changed, 214 insertions(+) create mode 100644 .gitignore create mode 100644 DeployTools/Deploy-FirstBoot.ps1 create mode 100644 DeployTools/Enable_Deploy-FirstBoot.cmd create mode 100644 DeployTools/INK_KickStart_Deploy-FirstBoot.lnk create mode 100644 DeployTools/KickStart_Deploy-FirstBoot.cmd create mode 100644 InstallTools/Choco-PKGS.list create mode 100644 InstallTools/Download-OandO-Tools.cmd create mode 100644 InstallTools/Install-Chocolatey.cmd create mode 100644 InstallTools/Install-From-Choco-PKGSlist.cmd create mode 100644 InstallTools/Remove-AdobeNotificationClient.cmd create mode 100644 ManagmentTools/KickStart_RunUpdates.cmd create mode 100644 ManagmentTools/RunUpdates for Apps & System.lnk create mode 100644 ManagmentTools/RunUpdates.ps1 create mode 100644 ReadMe.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..adb36c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.exe \ No newline at end of file diff --git a/DeployTools/Deploy-FirstBoot.ps1 b/DeployTools/Deploy-FirstBoot.ps1 new file mode 100644 index 0000000..f6a817f --- /dev/null +++ b/DeployTools/Deploy-FirstBoot.ps1 @@ -0,0 +1,53 @@ +############################################################### +# @description: # +# Used when image get cloned to new system # +# For Checking activation status, Setting SystemName, # +# running updates for Chocolatry apps and Windows Updates # +# # +# @project: IMGSystTools # +# @author: Bram Prieshof # +############################################################### + +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList " Set-ExecutionPolicy -Scope Process Unrestricted -Force; $CommandLine" + Exit + } +} + +Write-Output "Checking activation status..." +$ta = Get-CimInstance -ClassName SoftwareLicensingProduct -Filter "PartialProductKey IS NOT NULL" | Where-Object -Property Name -Like "Windows*" +if ($ta.LicenseStatus -eq 1) {Write-Outpute-Output "Activation [OK]"} else {Write-Output "Activation [Error, Opening settings]";Start-Process "ms-settings:activation"; pause } + +Write-Output "Getting System name" +$sysid = Read-Host -Prompt 'Please enter system ID (example: DT001)' +Rename-Computer -NewName $sysid +Write-Output "System name [OK]" + + +Write-Output "Checking Chocolatey package updates" +choco upgrade -y all +Write-Output " Chocolatey updates [OK]" + +Write-Output "Checking Windows updates" +Import-Module PSWindowsUpdate +Get-WUInstall -MicrosoftUpdate -AcceptAll -IgnoreReboot -IgnoreRebootRequired -Install +Write-Output " Windows updates [OK]" + +#Removing Created Shortcuts +Remove-Item C:\Users\Public\Desktop\*.lnk + +#Remove "Run on login script" if exists +if (Test-Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\FirstBoot.lnk" -PathType leaf) +{Remove-Item "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\FirstBoot.lnk"} + +#Finalizing and reboot +Write-Output "" +Write-Output "" +Write-Output "The System deployed successfully, but it needs to be rebooted" + +$confirmation = Read-Host "Do you want to do that now? y/N:" +if ($confirmation -eq 'y') { + Restart-Computer -Force +} diff --git a/DeployTools/Enable_Deploy-FirstBoot.cmd b/DeployTools/Enable_Deploy-FirstBoot.cmd new file mode 100644 index 0000000..7b49ee6 --- /dev/null +++ b/DeployTools/Enable_Deploy-FirstBoot.cmd @@ -0,0 +1,21 @@ +@echo off + +REM ############################################################### +REM # @description: # +REM # Used for enableing "Deploy-FirstBoot.ps1" on next boot # +REM # # +REM # @project: IMGSystTools # +REM # @author: Bram Prieshof # +REM ############################################################### + + +NET SESSION >nul 2>&1 +IF %ERRORLEVEL% EQU 0 ( + COPY "C:\SysTools\DeployTools\INK_KickStart_Deploy-FirstBoot.lnk" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\FirstBoot.lnk" + ECHO Enabled FirstBoot Deploy script + PAUSE +) ELSE ( + ECHO Please run this script as administrator + PAUSE +) + diff --git a/DeployTools/INK_KickStart_Deploy-FirstBoot.lnk b/DeployTools/INK_KickStart_Deploy-FirstBoot.lnk new file mode 100644 index 0000000000000000000000000000000000000000..67cb07f220eebec7417c805a2f33d562f4413685 GIT binary patch literal 1770 zcmbtUYiN^a6n;1Jw!}-E-bFy~spH&&RpE=R5B? z?|UxqW&oy{Q%HeMMd50L8CJ@l|N5x2qPfrX>VikFB>!z|>)*0Im9#^~2v4!7X(sZ@ z|0wIRJ}nAcj^8z7x!vAA7b_h_ft1ZSz8!^X75BEeEbui){hC%E1&T2pQxU)R(tF7( z|7^7Ko5a+t?8nIK6}cuKnh}K`8ozo=ce+_WnZ)~n0wT77d^Ks&zkc5 z@t9L3dA@oMCu$I(PmK{K`u`TIAW4XOZ@H`}^*Bm>{+2?UV~Z1L9ElP4{^XMXa{3p} zX{5;{EBA^l?@u?CB8(8~;Ddo6bkeE`aSPz0h0c2!%!}O7fQ>sEu#-OI)VoHwTtn6? zi2}969AX-=Yp`O-LSE(rOOeWSz*!Ti*P2z<1Et|mozDpBMpaT<;0o(eqgc}nTd0At ztPC5#WR5!<4iwSH+XV|uxbRq_tCNR6x{X|5XHB%u&>{tU*4cx4tQN)XNAyK|*Kaw~ z|4-k8D~a#Fi9NmTdGsv%>)U25-Jf{;zW?3y$&wt+z#y8Czpx3PsyHcPh6QW5_<@;q zF!7Bng0xsrHJP6+;Zj;DSrzS8x696~*F*b(Cx5o6YX4aBa8TBBqJvnF#jw;<38|7tnz>11FJ4Bw%Hg zr}Hj<(O03b+?O$}GV^fS?~eB1!})y=%9mtQFDaABo~aAp}vVBa32~CZbUD zCQT$DigXdiTd3_~F-#B(o+8Ueh6L%j-^M?t2clGD@3S<$eMWh)?$aHX?|A?)TX>74OhM0q(vT!s1H z;J&RybuMuvIGN7pcFZEGn~NZChk(d4MA%47y{@9nA}S?zq+gdOSJpwIT>6FmYQF;q zOHL2<nul 2>&1 +IF %ERRORLEVEL% EQU 0 ( + PowerShell.exe "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'))" + ECHO Chocolatey installed + PAUSE +) ELSE ( + ECHO Please run this script as administrator + PAUSE +) + diff --git a/InstallTools/Install-From-Choco-PKGSlist.cmd b/InstallTools/Install-From-Choco-PKGSlist.cmd new file mode 100644 index 0000000..3d81b52 --- /dev/null +++ b/InstallTools/Install-From-Choco-PKGSlist.cmd @@ -0,0 +1,24 @@ +@echo off + +REM ############################################################# +REM # @description: # +REM # Installes software listed in Choco-PGKS.list # +REM # using the Chocolatry package manager # +REM # # +REM # @project: IMGSystTools # +REM # @author: Bram Prieshof # +REM ############################################################# + + +NET SESSION >nul 2>&1 +IF %ERRORLEVEL% EQU 0 ( + echo Install packages listed in Choco-PKGS.list + pause + PowerShell.exe "$content = [IO.File]::ReadAllText("C:\SysTools\InstallTools\Choco-PKGS.list"); choco install $content -y" + echo Chocolatey installed + pasue +) ELSE ( + echo Please run this script as administrator + pause +) + diff --git a/InstallTools/Remove-AdobeNotificationClient.cmd b/InstallTools/Remove-AdobeNotificationClient.cmd new file mode 100644 index 0000000..63641cb --- /dev/null +++ b/InstallTools/Remove-AdobeNotificationClient.cmd @@ -0,0 +1,20 @@ +@echo off +REM ####################################### +REM # @description: # +REM # Removes AdobeNotificationClient # +REM # Run this just before sysprep, # +REM # since this app conflicts with it # +REM # # +REM # @project: IMGSystTools # +REM # @author: Bram Prieshof # +REM ####################################### + +NET SESSION >nul 2>&1 +IF %ERRORLEVEL% EQU 0 ( + PowerShell.exe "Get-AppxPackage -AllUsers *AdobeNotificationClient* | Remove-AppxPackage -AllUsers" + ECHO AdobeNotificationClient Removed + PAUSE +) ELSE ( + ECHO Please run this script as administrator + PAUSE +) diff --git a/ManagmentTools/KickStart_RunUpdates.cmd b/ManagmentTools/KickStart_RunUpdates.cmd new file mode 100644 index 0000000..a4e9d65 --- /dev/null +++ b/ManagmentTools/KickStart_RunUpdates.cmd @@ -0,0 +1,13 @@ +@echo off + +REM ################################################### +REM # @description: # +REM # Opens RunUpdates.ps1 in powershell with # +REM # Process ExecutionPolicy set to Unrestricted # +REM # # +REM # @project: IMGSystTools # +REM # @author: Bram Prieshof # +REM ################################################### + +echo Starting Update script... +PowerShell.exe "Set-ExecutionPolicy -Scope Process Unrestricted -Force; C:\SysTools\ManagmentTools\RunUpdates.ps1" diff --git a/ManagmentTools/RunUpdates for Apps & System.lnk b/ManagmentTools/RunUpdates for Apps & System.lnk new file mode 100644 index 0000000000000000000000000000000000000000..9c8fc6df5b875afce419fa392dfa28392443c896 GIT binary patch literal 1811 zcmbVMZA_C_6n?5AI6EnUF(uo;O*YMDDeC;dn4ztu1S+JhXqG1MQa-HE7TcEsfAG(e zZHZg9C7LY?=@y+owwah{{IO|Z+4c();tx=k!4ks!AX`Hd0?V?n=iE}LCUaru&2#U$ z&pr2^d+#~ttp;GoTg4U_P%Z2~BMU{;-}-E7psr`sVC|fmkp9~Gan;8-XC^XLE%yMC~l;O>cdLZS8ua0u(L2Ju^e zxNf*)PF#5mVw$Dwmzy^m{(>7lh`@sozjkWCMzk#LeBN$?^Wc$#70zBdJF>WQ+%;&6 zyUyEX=Xc9x>vhYUDsAqKe1j7jf+tXWWwmNM< z@qK&W^8NOCZC$hqEtU9HdMh6AKG{qo&LgX>)}EteI7*zn#k!qL4=R)<5`-x z@&zK*%lTzoLWuZ?Tw*mbI9oSwVqfD1gOGY-uTu+Zt%2sCuAbam<@dF@buFydyE=nM zJDN1TIb!w&=%9c;y;$k_3SdPU*F6~ zH9r}f`5Nu~8j|;p9cM4n)EsHkLmk^s?zL#)XbTSYT?lVEwcq*G*x#cQ-z7fmiaxqs zIW?X0&h0F`b~CF(+3$f$xBUTriU41 zSFA+1o_4$XWM%f;{Au9fZ@nrxKCYOYmGLH-qDXvG*g<`bkQAfQ2<#a{?&lj&cJ3Ga zm|ckXp8phs7l5ImAw;85?C)Mc{!d0|BO|!)sKYh%_pEkL9bfWgv9P*N}DrFbg3-PQF>!qOxp^hxX0!@TaMJo9xB1DEL=@x3a zSS(P)LRDWnp{|(jg*Qzmb!y2oLZn;B3q9sV(tn8%{UIUuw9FLWh*uPtF3qfJIMYA< zbtQS_u#k!r(lM4}kO>t+7sIxly%b@XLG-mkbkKb(6p((*qgh@)M^|M?xP x{I^3#lzoI8>S}(#_RR+!j?0d6^Th+*XXL^s#K1umetW84biktWB&jFce*l>#Zdm{T literal 0 HcmV?d00001 diff --git a/ManagmentTools/RunUpdates.ps1 b/ManagmentTools/RunUpdates.ps1 new file mode 100644 index 0000000..21fcd78 --- /dev/null +++ b/ManagmentTools/RunUpdates.ps1 @@ -0,0 +1,28 @@ +###################################################################### +# @description: # +# Used for running updates for Chocolatry apps and Windows Updates # +# When the system is all-ready deployed # +# # +# @project: IMGSystTools # +# @author: Bram Prieshof # +###################################################################### + +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList " Set-ExecutionPolicy -Scope Process Unrestricted -Force; $CommandLine" + Exit + } +} + +Write-Output "Checking Chocolatey package updates" +choco upgrade -y all +Write-Output " Chocolatey updates [OK]" + +Write-Output "Checking Windows updates" +Import-Module PSWindowsUpdate +Get-WUInstall -MicrosoftUpdate -AcceptAll -Install +Write-Output " Windows updates [OK]" + +#Removing Created Shortcuts +Remove-Item C:\Users\Public\Desktop\*.lnk \ No newline at end of file diff --git a/ReadMe.md b/ReadMe.md new file mode 100644 index 0000000..bb2d873 --- /dev/null +++ b/ReadMe.md @@ -0,0 +1,4 @@ +# SysTools +## Tools and scripts used for system image creation, maintainance and deployment + +Files expected in of C:\SysTools \ No newline at end of file