Last active
February 24, 2020 04:59
-
-
Save ndom91/801c78d5e18e6a84d49f5748c01aa3e4 to your computer and use it in GitHub Desktop.
Newtelco Windows Setup Script [boxstarter, choco, PS3.0+]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################### | |
# | |
# Newtelco Windows PC Setup Script | |
# Author: [email protected] | |
# Date: 05.04.19 | |
# | |
################################################### | |
# Install Boxstarter (run in a PowerShell (Administrator) shell) | |
Set-ExecutionPolicy RemoteSigned | |
. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force | |
# Disable UAC | |
Disable-UAC | |
# Rename the Computer (requires a reboot to take effect) | |
#$computername = "nt-test-1" # Desktop | |
$computername = $args[0] # Desktop | |
if ($env:computername -ne $computername) { | |
Rename-Computer -NewName $computername | |
} | |
# Prevent "Suggested Applications" from Returning | |
If (-Not (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content" | Out-Null | |
} | |
Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content" "DisableWindowsConsumerFeatures" 1 | |
# Disable Windows Features | |
Disable-BingSearch | |
Disable-GameBarTips | |
# Disable SMB1 - https://blogs.technet.microsoft.com/filecab/2016/09/16/stop-using-smb1/ | |
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol | |
# Enable Windows Features | |
# Enable WSL Support (https://docs.microsoft.com/en-us/windows/wsl/) | |
choco install Microsoft-Windows-Subsystem-Linux -source windowsfeatures | |
# Enable Hyper-V Support () | |
# choco install Microsoft-Hyper-V-All -source windowsFeatures | |
# Enable Remote Connectivity | |
# Enable Remote Desktop | |
Enable-RemoteDesktop | |
# OpenSSH (https://blogs.technet.microsoft.com/heyscriptingguy/2017/12/29/cross-platform-powershell-remoting-in-action/) | |
choco install -y openssh -params '"/SSHServerFeature"' | |
# Remove Microsoft Software | |
Get-AppxPackage Microsoft.3DBuilder | Remove-AppxPackage # 3D Builder | |
Get-AppxPackage Microsoft.Appconnector | Remove-AppxPackage # App Connector | |
Get-AppxPackage Microsoft.BingFinance | Remove-AppxPackage # Money | |
Get-AppxPackage Microsoft.BingFoodAndDrink | Remove-AppxPackage # Food & Drink | |
Get-AppxPackage Microsoft.BingHealthAndFitness | Remove-AppxPackage # Health & Fitness | |
Get-AppxPackage Microsoft.BingNews | Remove-AppxPackage # News | |
Get-AppxPackage Microsoft.BingSports | Remove-AppxPackage # Sports | |
Get-AppxPackage Microsoft.BingTranslator | Remove-AppxPackage # Translator | |
Get-AppxPackage Microsoft.BingTravel | Remove-AppxPackage # Travel | |
Get-AppxPackage Microsoft.BingWeather | Remove-AppxPackage # Weather | |
Get-AppxPackage Microsoft.CommsPhone | Remove-AppxPackage # Phone | |
Get-AppxPackage Microsoft.ConnectivityStore | Remove-AppxPackage # Microsoft Wi-Fi | |
Get-AppxPackage Microsoft.FreshPaint | Remove-AppxPackage # Fresh Paint | |
Get-AppxPackage Microsoft.GetHelp | Remove-AppxPackage # Get Help | |
Get-AppxPackage Microsoft.Getstarted | Remove-AppxPackage # Get Started / Tips | |
Get-AppxPackage Microsoft.Messaging | Remove-AppxPackage # Messaging | |
Get-AppxPackage Microsoft.Microsoft3DViewer | Remove-AppxPackage # View 3D | |
Get-AppxPackage Microsoft.MicrosoftOfficeHub | Remove-AppxPackage # Get Office | |
Get-AppxPackage Microsoft.MicrosoftPowerBIForWindows | Remove-AppxPackage # Microsoft Power BI Desktop | |
Get-AppxPackage Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage # Microsoft Solitaire Collectio | |
Get-AppxPackage Microsoft.MicrosoftStickyNotes | Remove-AppxPackage # Sticky Notes | |
Get-AppxPackage Microsoft.MinecraftUWP | Remove-AppxPackage # Minecraft for Windows 10 | |
# Get-AppxPackage Microsoft.MSPaint | Remove-AppxPackage # Paint 3D | |
Get-AppxPackage Microsoft.NetworkSpeedTest | Remove-AppxPackage # Network Speed Test | |
Get-AppxPackage Microsoft.Office.OneNote | Remove-AppxPackage # OneNote Windows Store Version | |
Get-AppxPackage Microsoft.Office.Sway | Remove-AppxPackage # Sway | |
Get-AppxPackage Microsoft.OneConnect | Remove-AppxPackage # Paid Wi-Fi & Cellular | |
Get-AppxPackage Microsoft.People | Remove-AppxPackage # People | |
Get-AppxPackage Microsoft.Print3D | Remove-AppxPackage # Print 3D | |
Get-AppxPackage Microsoft.SkypeApp | Remove-AppxPackage # Get Skype | |
Get-AppxPackage Microsoft.Wallet | Remove-AppxPackage # Microsoft Wallet | |
Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage # Photos | |
Get-AppxPackage Microsoft.WindowsAlarms | Remove-AppxPackage # Alarms & Clock | |
# Get-AppxPackage Microsoft.WindowsCalculator | Remove-AppxPackage # Calculator | |
Get-AppxPackage Microsoft.WindowsCamera | Remove-AppxPackage # Camera | |
Get-AppxPackage microsoft.windowscommunicationsapps | Remove-AppxPackage # Calendar and Mail | |
Get-AppxPackage Microsoft.WindowsFeedbackHub | Remove-AppxPackage # Feedback Hub | |
Get-AppxPackage Microsoft.WindowsMaps | Remove-AppxPackage # Maps | |
Get-AppxPackage Microsoft.WindowsPhone | Remove-AppxPackage # Phone Companion | |
Get-AppxPackage Microsoft.WindowsReadingList | Remove-AppxPackage # Windows Reading List | |
Get-AppxPackage Microsoft.WindowsSoundRecorder | Remove-AppxPackage # Voice Recorder | |
# Get-AppxPackage Microsoft.WindowsStore | Remove-AppxPackage # Windows Store (be careful removing this one) | |
Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage # Xbox | |
Get-AppxPackage Microsoft.XboxGameOverlay | Remove-AppxPackage # Game Bar | |
Get-AppxPackage Microsoft.XboxIdentityProvider | Remove-AppxPackage # Xbox Live Login Provider for Programs/Games | |
Get-AppxPackage Microsoft.XboxSpeechToTextOverlay | Remove-AppxPackage # | |
Get-AppxPackage Microsoft.ZuneMusic | Remove-AppxPackage # Groove Music | |
Get-AppxPackage Microsoft.ZuneVideo | Remove-AppxPackage # Movies & TV | |
# Remove Third-Party Software | |
Get-AppxPackage 2FE3CB00.PicsArt-PhotoStudio | Remove-AppxPackage | |
Get-AppxPackage 46928bounde.EclipseManager | Remove-AppxPackage | |
Get-AppxPackage 4DF9E0F8.Netflix | Remove-AppxPackage | |
Get-AppxPackage 6Wunderkinder.Wunderlist | Remove-AppxPackage | |
Get-AppxPackage 89006A2E.AutodeskSketchBook | Remove-AppxPackage | |
Get-AppxPackage 9E2F88E3.Twitter | Remove-AppxPackage | |
Get-AppxPackage A278AB0D.DisneyMagicKingdoms | Remove-AppxPackage | |
Get-AppxPackage A278AB0D.MarchofEmpires | Remove-AppxPackage | |
Get-AppxPackage ActiproSoftwareLLC.562882FEEB491 | Remove-AppxPackage | |
Get-AppxPackage ClearChannelRadioDigital.iHeartRadio | Remove-AppxPackage | |
Get-AppxPackage D52A8D61.FarmVille2CountryEscape | Remove-AppxPackage | |
Get-AppxPackage D5EA27B7.Duolingo-LearnLanguagesforFree | Remove-AppxPackage | |
Get-AppxPackage DB6EA5DB.CyberLinkMediaSuiteEssentials | Remove-AppxPackage | |
Get-AppxPackage DolbyLaboratories.DolbyAccess | Remove-AppxPackage | |
Get-AppxPackage Drawboard.DrawboardPDF | Remove-AppxPackage | |
Get-AppxPackage Facebook.Facebook | Remove-AppxPackage | |
Get-AppxPackage flaregamesGmbH.RoyalRevolt2 | Remove-AppxPackage | |
Get-AppxPackage Flipboard.Flipboard | Remove-AppxPackage | |
Get-AppxPackage GAMELOFTSA.Asphalt8Airborne | Remove-AppxPackage | |
Get-AppxPackage KeeperSecurityInc.Keeper | Remove-AppxPackage | |
Get-AppxPackage king.com.* | Remove-AppxPackage | |
Get-AppxPackage king.com.CandyCrushSaga | Remove-AppxPackage | |
Get-AppxPackage king.com.CandyCrushSodaSaga | Remove-AppxPackage | |
Get-AppxPackage PandoraMediaInc.29680B314EFC2 | Remove-AppxPackage | |
Get-AppxPackage Playtika.CaesarsSlotsFreeCasino | Remove-AppxPackage | |
Get-AppxPackage ShazamEntertainmentLtd.Shazam | Remove-AppxPackage | |
Get-AppxPackage SpotifyAB.SpotifyMusic | Remove-AppxPackage | |
Get-AppxPackage TheNewYorkTimes.NYTCrossword | Remove-AppxPackage | |
Get-AppxPackage ThumbmunkeysLtd.PhototasticCollage | Remove-AppxPackage | |
Get-AppxPackage TuneIn.TuneInRadio | Remove-AppxPackage | |
Get-AppxPackage WinZipComputing.WinZipUniversal | Remove-AppxPackage | |
Get-AppxPackage XINGAG.XING | Remove-AppxPackage | |
Get-AppxPackage *BubbleWitch* | Remove-AppxPackage | |
Get-AppxPackage *Dropbox* | Remove-AppxPackage | |
Get-AppxPackage *Hidden*City* | Remove-AppxPackage | |
Get-AppxPackage *McAfee* | Remove-AppxPackage | |
Get-AppxPackage *Plex* | Remove-AppxPackage | |
Get-AppxPackage *Solitaire* | Remove-AppxPackage | |
# Really make sure McAfee is removed | |
$mcafee = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "McAfee Security" } | select UninstallString | |
if ($mcafee) { | |
$mcafee = $mcafee.UninstallString -Replace "C:\Program Files\McAfee\MSC\mcuihost.exe","" | |
Write "Uninstalling McAfee..." | |
start-process "C:\Program Files\McAfee\MSC\mcuihost.exe" -arg "$mcafee" -Wait | |
} | |
# Privacy: Let apps use my advertising ID: Disable | |
If (-Not (Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) { | |
New-Item -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo | Out-Null | |
} | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0 | |
# WiFi Sense: HotSpot Sharing: Disable | |
If (-Not (Test-Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) { | |
New-Item -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting | Out-Null | |
} | |
Set-ItemProperty -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting -Name value -Type DWord -Value 0 | |
# WiFi Sense: Shared HotSpot Auto-Connect: Disable | |
Set-ItemProperty -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots -Name value -Type DWord -Value 0 | |
# Start Menu: Disable Bing Search Results | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 0 | |
# Disable Telemetry (requires a reboot to take effect) (may break Insider builds for your organization) | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -Type DWord -Value 0 | |
Get-Service DiagTrack,Dmwappushservice | Stop-Service | Set-Service -StartupType Disabled | |
# Disable the Lock Screen (the one before password prompt - to prevent dropping the first character) | |
If (-Not (Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization)) { | |
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows -Name Personalization | Out-Null | |
} | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Type DWord -Value 1 | |
# To Restore OR to change Lock Screen Wallpaper settings, this needs to be re-enabled to make the change. Disable again after. | |
# Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Type DWord -Value 0 | |
# Turn off People in Taskbar | |
If (-Not (Test-Path "HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People")) { | |
New-Item -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name PeopleBand -Type DWord -Value 0 | |
# Disable Cortana | |
# Same as gpedit.msc > Computer Configuration > Administrative Templates > Windows Components > Search > Allow Cortana = No | |
If (-Not (Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) { | |
New-Item -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo | Out-Null | |
} | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "Windows Search" -ItemType Key | |
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name AllowCortana -Type DWORD -Value 0 | |
# Configure Explorer | |
# Show File Extensions | |
Set-WindowsExplorerOptions -EnableShowFileExtensions | |
# Change Explorer home screen back to "This PC" instead of | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Type DWord -Value 1 | |
# Disable Quick Access: Recent Files | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 0 | |
# Disable Quick Access: Frequent Folders | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 0 | |
# Add Fonts | |
# These packages are available from https://chocolatey.org/ | |
# choco install firacode -y # (https://github.com/tonsky/FiraCode) | |
# Install Drivers | |
# These packages are available from https://chocolatey.org/ | |
#choco install logitechgaming -y # Logitech Gaming Software (https://support.logitech.com/en_us/software/lgs) (for Logitech Gaming Mouse G500) | |
#choco install logitech-options -y # Logitech Options (https://support.logitech.com/en_us/software/options) (for Logitech M720 Triathlon) | |
# Install Software | |
# These packages are available from https://chocolatey.org/ | |
# choco install bitwarden -y # Bitwarden (https://bitwarden.com/) - standalone installer; I use the Microsoft Store version now | |
#choco install cura -y # Ultimaker Cura (https://ultimaker.com/en/products/ultimaker-cura-software) | |
#choco install discord -y # Discord (https://discordapp.com/) | |
# docker-for-windows # Docker for Windows (https://docs.docker.com/docker-for-windows/install/) | |
# choco install itunes -y # iTunes (https://www.apple.com/itunes/) - standalone installer; I use the Microsoft Store version now | |
#choco install krita -y # Krita (https://krita.org/) | |
#choco install obs-studio -y # OBS Studio (https://obsproject.com/) | |
# choco install telegram -y # Telegram (https://telegram.org/) - standalone installer; I use Unigram from the Microsoft Store now | |
# Install Drivers | |
choco install sdio -y # Snappy Driver Installer Origin (https://sdi-tool.org/) | |
# Install Drivers | |
choco install vlc -y # VLC (https://www.videolan.org/) | |
choco install nextcloud-client -y # Nextcloud Desktop Client (https://nextcloud.com/clients/) | |
choco install sharex -y # ShareX (https://getsharex.com/) - standalone installer; I use the Microsoft Store version now | |
choco install teamviewer -y # Teamviewer (https://www.teamviewer.com/) - standalone installer; I use the Microsoft Store version now | |
choco install vscode -y # Visual Studio Code (https://code.visualstudio.com/) | |
choco install 7zip -y # 7zip (https://www.7-zip.org/) | |
choco install googlechrome -y # Google Chrome (https://chrome.google.com) | |
choco install firefox -y # Mozilla Firefox (https://getfirefox.com) | |
choco install ublockorigin-firefox -y # Firefox Addon - UBlock Origin (https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/) | |
choco install windirstat -y # Windirstat (https://windirstat.net/) | |
choco install notepadplusplus -y # Notepad++ (https://notepad-plus-plus.org/) | |
# Newtelco Software | |
choco install vnc-viewer -y | |
choco install winscp -y | |
choco install kitty -y | |
choco install filezilla -y | |
choco install jre8 -y | |
choco install foxitreader -y | |
choco install ccleaner -y | |
choco install google-drive-file-stream -y | |
choco install gsuite-sync-outlook -y | |
choco install google-hangouts-chrome -y | |
# Download Firefox Nightly Installer (https://blog.nightly.mozilla.org/) (needs to be run manually) | |
# Invoke-WebRequest -UseBasicParsing "https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-central-l10n/Firefox%20Installer.en-US.exe" -OutFile "$HOME\Downloads\Firefox Nightly Installer.en-US.exe" | |
# Install Games | |
# Installation target is defined with --install-directory otherwise the default PATH is used | |
#chcoo install battle.net -y --install-directory='D:\Games\Battle.net' # Battle.net (https://www.blizzard.com/) | |
#choco install goggalaxy -y --install-directory='D:\Games\GOG Galaxy' # GOG Galaxy (https://www.gog.com/) | |
#choco install origin -y --install-directory='D:\Games\Origin' # Origin (https://www.origin.com/) | |
#choco install steam -y --install-directory='D:\Games\Steam' # Steam (https://store.steampowered.com/) | |
# Install Visual Studio Code Extensions | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension bierner.markdown-preview-github-styles | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension coenraads.bracket-pair-colorizer | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension csholmq.excel-to-markdown-table | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension davidanson.vscode-markdownlint | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension deerawan.vscode-hasher | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension dotjoshjohnson.xml | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension esbenp.prettier-vscode | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension grapecity.gc-excelviewer | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension ionutvmi.reg | |
# # & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension mattn.lisp | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension mechatroner.rainbow-csv | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension ms-python.python | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension ms-vscode.csharp | |
# # & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension nopjmp.fairyfloss | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension robertohuertasm.vscode-icons | |
# # & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension teabyii.ayu | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension tomoki1207.selectline-statusbar | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension wesbos.theme-cobalt2 | |
# & "$HOME\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --install-extension yzhang.markdown-all-in-one | |
# Folder Setup | |
# Move Downloads folder to D:\Library\Downloads | |
# Move-LibraryDirectory "{374DE290-123F-4565-9164-39C4925E467B}" "D:\Library\Downloads" | |
# Taskbar Setup | |
# Add to Taskbar: Firefox Nightly | |
#Install-ChocolateyPinnedTaskBarItem -TargetFilePath "$env:programfiles\Firefox Nightly\firefox.exe" | |
# Add to Taskbar: Visual Studio Code | |
#Install-ChocolateyPinnedTaskBarItem -TargetFilePath "$env:programfiles\Microsoft VS Code\Code.exe" | |
# Add to Taskbar: Google Chrome | |
#Install-ChocolateyPinnedTaskBarItem -TargetFilePath "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe" | |
# Set File Associations: Visual Studio Code | |
# Install-ChocolateyFileAssociation ".bat" "${env:ProgramFiles(x86)}\Microsoft VS Code\Code.exe" | |
# Install-ChocolateyFileAssociation ".cnf" "${env:ProgramFiles(x86)}\Microsoft VS Code\Code.exe" | |
# Install-ChocolateyFileAssociation ".ini" "${env:ProgramFiles(x86)}\Microsoft VS Code\Code.exe" | |
# Install-ChocolateyFileAssociation ".log" "${env:ProgramFiles(x86)}\Microsoft VS Code\Code.exe" | |
# Install-ChocolateyFileAssociation ".sql" "${env:ProgramFiles(x86)}\Microsoft VS Code\Code.exe" | |
# Install-ChocolateyFileAssociation ".txt" "${env:ProgramFiles(x86)}\Microsoft VS Code\Code.exe" | |
# Install-ChocolateyFileAssociation ".md" "${env:ProgramFiles(x86)}\Microsoft VS Code\Code.exe" | |
function Decrypt-String($Encrypted, $Passphrase, $salt="SaltCrypto", $init="IV_Password") | |
{ | |
# If the value in the Encrypted is a string, convert it to Base64 | |
if($Encrypted -is [string]){ | |
$Encrypted = [Convert]::FromBase64String($Encrypted) | |
} | |
# Create a COM Object for RijndaelManaged Cryptography | |
$r = new-Object System.Security.Cryptography.RijndaelManaged | |
# Convert the Passphrase to UTF8 Bytes | |
$pass = [Text.Encoding]::UTF8.GetBytes($Passphrase) | |
# Convert the Salt to UTF Bytes | |
$salt = [Text.Encoding]::UTF8.GetBytes($salt) | |
# Create the Encryption Key using the passphrase, salt and SHA1 algorithm at 256 bits | |
$r.Key = (new-Object Security.Cryptography.PasswordDeriveBytes $pass, $salt, "SHA1", 5).GetBytes(32) #256/8 | |
# Create the Intersecting Vector Cryptology Hash with the init | |
$r.IV = (new-Object Security.Cryptography.SHA1Managed).ComputeHash( [Text.Encoding]::UTF8.GetBytes($init) )[0..15] | |
# Create a new Decryptor | |
$d = $r.CreateDecryptor() | |
# Create a New memory stream with the encrypted value. | |
$ms = new-Object IO.MemoryStream @(,$Encrypted) | |
# Read the new memory stream and read it in the cryptology stream | |
$cs = new-Object Security.Cryptography.CryptoStream $ms,$d,"Read" | |
# Read the new decrypted stream | |
$sr = new-Object IO.StreamReader $cs | |
# Return from the function the stream | |
Write-Output $sr.ReadToEnd() | |
# Stops the stream | |
$sr.Close() | |
# Stops the crypology stream | |
$cs.Close() | |
# Stops the memory stream | |
$ms.Close() | |
# Clears the RijndaelManaged Cryptology IV and Key | |
$r.Clear() | |
} | |
$encrypted = Decrypt-String "[INSERT ENCRYPTED PW HERE]" "MyStrongPassword" | |
# Add PC to Domain | |
# Source: https://community.spiceworks.com/scripts/show/1540-join-computer-to-domain-with-powershell-one-click-method | |
$domain = "newtelco.local" | |
# INSECURE - TO-DO: change to grab encrypted PW file.. | |
$password = $encrypted | ConvertTo-SecureString -asPlainText -Force | |
$username = "NEWTELCOSRV\ndomino" | |
$credential = New-Object System.Management.Automation.PSCredential($username,$password) | |
Add-Computer -DomainName $domain -Credential $credential | |
# Enable UAC | |
Enable-UAC | |
# Enable and run Microsoft Updates | |
Enable-MicrosoftUpdate | |
Install-WindowsUpdate -acceptEula | |
if (Test-PendingReboot) { Invoke-Reboot } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Decrypt-String($Encrypted, $Passphrase, $salt="SaltCrypto", $init="IV_Password") | |
{ | |
# If the value in the Encrypted is a string, convert it to Base64 | |
if($Encrypted -is [string]){ | |
$Encrypted = [Convert]::FromBase64String($Encrypted) | |
} | |
# Create a COM Object for RijndaelManaged Cryptography | |
$r = new-Object System.Security.Cryptography.RijndaelManaged | |
# Convert the Passphrase to UTF8 Bytes | |
$pass = [Text.Encoding]::UTF8.GetBytes($Passphrase) | |
# Convert the Salt to UTF Bytes | |
$salt = [Text.Encoding]::UTF8.GetBytes($salt) | |
# Create the Encryption Key using the passphrase, salt and SHA1 algorithm at 256 bits | |
$r.Key = (new-Object Security.Cryptography.PasswordDeriveBytes $pass, $salt, "SHA1", 5).GetBytes(32) #256/8 | |
# Create the Intersecting Vector Cryptology Hash with the init | |
$r.IV = (new-Object Security.Cryptography.SHA1Managed).ComputeHash( [Text.Encoding]::UTF8.GetBytes($init) )[0..15] | |
# Create a new Decryptor | |
$d = $r.CreateDecryptor() | |
# Create a New memory stream with the encrypted value. | |
$ms = new-Object IO.MemoryStream @(,$Encrypted) | |
# Read the new memory stream and read it in the cryptology stream | |
$cs = new-Object Security.Cryptography.CryptoStream $ms,$d,"Read" | |
# Read the new decrypted stream | |
$sr = new-Object IO.StreamReader $cs | |
# Return from the function the stream | |
Write-Output $sr.ReadToEnd() | |
# Stops the stream | |
$sr.Close() | |
# Stops the crypology stream | |
$cs.Close() | |
# Stops the memory stream | |
$ms.Close() | |
# Clears the RijndaelManaged Cryptology IV and Key | |
$r.Clear() | |
} | |
$encrypted = Decrypt-String $args[0] "MyStrongPassword" | |
echo $encrypted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################# | |
# Powershell Allows The Loading of .NET Assemblies | |
# Load the Security assembly to use with this script | |
################# | |
[Reflection.Assembly]::LoadWithPartialName("System.Security") | |
################# | |
# This function is to Encrypt A String. | |
# $string is the string to encrypt, $passphrase is a second security "password" that has to be passed to decrypt. | |
# $salt is used during the generation of the crypto password to prevent password guessing. | |
# $init is used to compute the crypto hash -- a checksum of the encryption | |
################# | |
function Encrypt-String($String, $Passphrase, $salt="SaltCrypto", $init="IV_Password", [switch]$arrayOutput) | |
{ | |
# Create a COM Object for RijndaelManaged Cryptography | |
$r = new-Object System.Security.Cryptography.RijndaelManaged | |
# Convert the Passphrase to UTF8 Bytes | |
$pass = [Text.Encoding]::UTF8.GetBytes($Passphrase) | |
# Convert the Salt to UTF Bytes | |
$salt = [Text.Encoding]::UTF8.GetBytes($salt) | |
# Create the Encryption Key using the passphrase, salt and SHA1 algorithm at 256 bits | |
$r.Key = (new-Object Security.Cryptography.PasswordDeriveBytes $pass, $salt, "SHA1", 5).GetBytes(32) #256/8 | |
# Create the Intersecting Vector Cryptology Hash with the init | |
$r.IV = (new-Object Security.Cryptography.SHA1Managed).ComputeHash( [Text.Encoding]::UTF8.GetBytes($init) )[0..15] | |
# Starts the New Encryption using the Key and IV | |
$c = $r.CreateEncryptor() | |
# Creates a MemoryStream to do the encryption in | |
$ms = new-Object IO.MemoryStream | |
# Creates the new Cryptology Stream --> Outputs to $MS or Memory Stream | |
$cs = new-Object Security.Cryptography.CryptoStream $ms,$c,"Write" | |
# Starts the new Cryptology Stream | |
$sw = new-Object IO.StreamWriter $cs | |
# Writes the string in the Cryptology Stream | |
$sw.Write($String) | |
# Stops the stream writer | |
$sw.Close() | |
# Stops the Cryptology Stream | |
$cs.Close() | |
# Stops writing to Memory | |
$ms.Close() | |
# Clears the IV and HASH from memory to prevent memory read attacks | |
$r.Clear() | |
# Takes the MemoryStream and puts it to an array | |
[byte[]]$result = $ms.ToArray() | |
# Converts the array from Base 64 to a string and returns | |
return [Convert]::ToBase64String($result) | |
} | |
function Decrypt-String($Encrypted, $Passphrase, $salt="SaltCrypto", $init="IV_Password") | |
{ | |
# If the value in the Encrypted is a string, convert it to Base64 | |
if($Encrypted -is [string]){ | |
$Encrypted = [Convert]::FromBase64String($Encrypted) | |
} | |
# Create a COM Object for RijndaelManaged Cryptography | |
$r = new-Object System.Security.Cryptography.RijndaelManaged | |
# Convert the Passphrase to UTF8 Bytes | |
$pass = [Text.Encoding]::UTF8.GetBytes($Passphrase) | |
# Convert the Salt to UTF Bytes | |
$salt = [Text.Encoding]::UTF8.GetBytes($salt) | |
# Create the Encryption Key using the passphrase, salt and SHA1 algorithm at 256 bits | |
$r.Key = (new-Object Security.Cryptography.PasswordDeriveBytes $pass, $salt, "SHA1", 5).GetBytes(32) #256/8 | |
# Create the Intersecting Vector Cryptology Hash with the init | |
$r.IV = (new-Object Security.Cryptography.SHA1Managed).ComputeHash( [Text.Encoding]::UTF8.GetBytes($init) )[0..15] | |
# Create a new Decryptor | |
$d = $r.CreateDecryptor() | |
# Create a New memory stream with the encrypted value. | |
$ms = new-Object IO.MemoryStream @(,$Encrypted) | |
# Read the new memory stream and read it in the cryptology stream | |
$cs = new-Object Security.Cryptography.CryptoStream $ms,$d,"Read" | |
# Read the new decrypted stream | |
$sr = new-Object IO.StreamReader $cs | |
# Return from the function the stream | |
Write-Output $sr.ReadToEnd() | |
# Stops the stream | |
$sr.Close() | |
# Stops the crypology stream | |
$cs.Close() | |
# Stops the memory stream | |
$ms.Close() | |
# Clears the RijndaelManaged Cryptology IV and Key | |
$r.Clear() | |
} | |
# This clears the screen of the output from the loading of the assembly. | |
cls | |
# $me will never = 1, so It will run indefinately | |
$me = 0 | |
write-host "To End This Application, Close the Window" | |
Write-host "" | |
do | |
{ | |
# Prompt the user for the password | |
$string = read-host "Please Enter User Password" | |
# Encrypt the string and store it into the $encrypted variable | |
$encrypted = Encrypt-String $string "MyStrongPassword" | |
# Write result to the screen | |
write-host "Encrypted Password is: $encrypted" | |
write-host "" | |
write-host "Testing Decryption of Password..." | |
# Decrypts the string and stores the decrypted value in $decrypted | |
$decrypted = Decrypt-String $encrypted "MyStrongPassword" | |
# Writes the decrpted value to the screen | |
write-host "Decrypted Password is: $decrypted" | |
write-host "" | |
} | |
while ($me -ne 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -RunAsAdministrator | |
################################################### | |
# | |
# Newtelco Windows PC Setup Script | |
# Author: [email protected] | |
# Date: 05.04.19 | |
# | |
# To Begin: | |
# > Invoke-RestMethod -Method Get -Uri | |
# "https://home.newtelco.de/newtelco_init.ps1" | |
# -OutFile newtelco_init.ps1 | |
# | |
# > Set-ExecutionPolicy RemoteSigned [A - Accept] | |
# | |
# > ./newtelco_init.ps1 "[PC NAME]" | |
# | |
################################################### | |
Set-ExecutionPolicy RemoteSigned | |
cls | |
echo "#############################################" | |
echo "#" | |
echo "# Welcome to the Newtelco Setup Script" | |
echo "# Author: [email protected]" | |
echo "#" | |
echo "# Last Updated: 05.04.2019" | |
echo "#" | |
echo "#############################################" | |
echo " " | |
# PREPARE | |
# Check if in Admin Powershell | |
function Test-Administrator | |
{ | |
[OutputType([bool])] | |
param() | |
process { | |
[Security.Principal.WindowsPrincipal]$user = [Security.Principal.WindowsIdentity]::GetCurrent(); | |
return $user.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator); | |
} | |
} | |
if(-not (Test-Administrator)) | |
{ | |
# TODO: define proper exit codes for the given errors | |
Write-Error "# ERROR: This script must be executed as Administrator."; | |
exit 1; | |
} | |
$ErrorActionPreference = "Stop"; | |
#echo "" | |
#echo "# Setting Execution Policy to 'Bypass'" | |
echo "# Downloading Setup Script..." | |
echo "" | |
# cURL DL Script | |
Invoke-RestMethod -Method Get -Uri "https://home.newtelco.de/boxstarter_newtelco.ps1" -OutFile boxstarter_newtelco.ps1 | |
echo "# Script Downloaded. Now Executing - Go get a coffee ;) " | |
echo "" | |
echo "" | |
# run script | |
$computerName = $args[0] | |
& "$PSScriptRoot\boxstarter_newtelco.ps1" "$computerName" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment