├── .gitignore ├── LICENSE.md ├── README.md ├── scripts ├── README.md ├── add_to_startup.ps1 ├── archive_executable.ps1 ├── disable_edge_ui.ps1 ├── disable_firewall.ps1 ├── disable_screensaver.ps1 ├── disable_windows_key.ps1 ├── disable_windows_update.ps1 ├── download_folder.ps1 ├── download_from_bitbucket.ps1 ├── download_release.ps1 ├── enable_autologin.ps1 ├── install_chocolatey_development.ps1 ├── install_chocolatey_production.ps1 ├── launch_application_cycle.ps1 ├── publish_folder.ps1 ├── publish_release.ps1 ├── publish_to_bitbucket.ps1 ├── set_admin_username.ps1 ├── set_background.ps1 ├── set_computer_name.ps1 ├── set_ip.ps1 ├── set_power_settings.ps1 ├── set_scheduled_reboot.ps1 ├── set_timezone.ps1 └── settings │ ├── config.ps1 │ ├── power_settings.conf │ └── power_settings.pow ├── set_configuration.ps1 ├── setup_development.ps1 └── setup_production.ps1 /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | 47 | # Translations 48 | *.mo 49 | *.pot 50 | 51 | # Django stuff: 52 | *.log 53 | 54 | # Sphinx documentation 55 | docs/_build/ 56 | 57 | # PyBuilder 58 | target/ 59 | 60 | #* 61 | *~ 62 | *_machine/ 63 | !7za.exe 64 | *.tar.gz -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Nathan S Lachenmyer 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Windows Setup Script 2 | 3 | ## Requirements 4 | * Windows 8 or newer (doesn't work in Windows 7 :( ) 5 | 6 | ### Usage 7 | Create the desired settings in `scripts/settings/config.ps1`. 8 | 9 | Run either `./setup_development.ps1` for a develpoment computer (lots of software useful for writing, compiling, and testing code) or `./setup_production.ps1` for a production computer (much more minimal). 10 | 11 | ## OLD README (not useful anymore) 12 | 13 | ### Computer Configuration 14 | In the `scripts` folder, there are a variety of scripts that can be used to change your computer settings. Ones I recommend using: 15 | 16 | * `disable_edge_ui.ps1` to disable Windows 8/10 Edge UI features. 17 | * `disable_firewall.ps1` to disable the default Windows Firewall. 18 | * `disable_screensaver.ps1` does the obvious. 19 | * `disable_windows_update.ps1` disables prompts to update Windows. 20 | * `enable_autologin.ps1` enables automatic login if `config.ps1` contains the proper username / password combination. 21 | * `set_ip.ps1` configures the IP based off of settings in `config.ps1`. 22 | * `set_power_settings.ps1` loads a power settings configuration file I exported that disables all power saving features. 23 | * `set_scheduled_reboot.ps1` configures the computer for a daily reboot at a specific time, defined in `config.ps1`. 24 | 25 | There are also a few other utilites that are less useful, but may be useful in certain situations regardless. 26 | 27 | ## Executable Maintenance 28 | I also wrote a few utilities that are meant to make maintaining installations a bit easier. The main one that's useful is `publish_release.ps1` and `download_release.ps1`. These require cURL, which is included in both of the computer setup builds above. 29 | 30 | You can use these scripts by placing the entirety of the `scripts/` folder in your project's root directory. 31 | 32 | NOTE: you'll want to check `config.ps1` to make sure it has the right paths before running this. 33 | 34 | ### Publishing a Release 35 | Running `publish_release.ps1` from the powershell will: 36 | 37 | * Grab the executable from your root directory, 38 | * Place it in your `bin/` folder, and archive it into a dated folder (with a copy of your `CHANGELOG.md`, if you have one), 39 | * Creates a `.tar.gz` archive and sends it to Bitbucket's Download page. 40 | 41 | ### Downloading a Release 42 | Running `download_release.ps1` from the powershell will: 43 | 44 | * Download a folder named with today's date from Bitbucket's Download page (optionally, you can provide a name for the file). 45 | * Unzip the tar archive, 46 | * Place the dated archive folder in your `bin/` folder, 47 | * Copy the executable to your `bin/` folder, 48 | * And create a shortcut for it, and place that shortcut in your startup folder. 49 | 50 | This is designed to make the process of adding a new version of software to a project much less painful. 51 | 52 | ### Publishing / Downloading other files 53 | You can also publish / download other files using Bitbucket's Download page by calling the scripts `publish_to_bitbucket.ps1` and `download_from_bitbucket.ps1` with a specific file as an argument. -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | # Management 2 | 3 | These scripts are for maintenance and management of existing applications. These are handy for dealing with an application already installed on a computer and for dealing with common maintenance tasks. 4 | 5 | For these scripts to work, they'll need to be in your `runtime` folder. The default folder is `runtime/management` but any folder with the same relative path will work. 6 | 7 | All project-specific configurations can go into `config.ps1`. 8 | 9 | For bitbucket scripts, create a file `settings/bitbucket_credentials.ps` and fill out the parameters `$SECRET_username` and `$SECRET_password`. -------------------------------------------------------------------------------- /scripts/add_to_startup.ps1: -------------------------------------------------------------------------------- 1 | # add_to_startup.ps1 2 | # ------------------------- 3 | # Creates a shortcut for launch_application.ps1 and places it in the startup folder. 4 | # 5 | 6 | if(!(Test-Path ./settings/config.ps1)) { 7 | Write-Host "" 8 | Write-Host "Could not find configuration file!" 9 | Write-Host "Please create a file /settings/config.ps1 with parameters $CONFIG_team_name and $CONFIG_project_name." 10 | exit 11 | } 12 | 13 | . ./settings/config.ps1 14 | 15 | $path = (Resolve-Path "$CONFIG_exe_path/$CONFIG_exe_name").Path 16 | Write-Host $path 17 | Write-Host "" 18 | # Set-Content startup.cmd "PowerShell -File `"$path\launch_application_cycle.ps1`"" 19 | 20 | $target = "$path" 21 | $shortcut_path = "$((Resolve-Path "$CONFIG_exe_path").Path)/startup.lnk" 22 | $WScriptShell = New-Object -ComObject WScript.Shell 23 | $shortcut = $WScriptShell.CreateShortcut($shortcut_path) 24 | $shortcut.TargetPath = $target 25 | $shortcut.WorkingDirectory = $path 26 | $shortcut.Save() 27 | 28 | Move-Item $CONFIG_exe_path/startup.lnk "C:\Users\sdf\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" -force -------------------------------------------------------------------------------- /scripts/archive_executable.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [system.io.fileinfo]$file = $null 3 | ) 4 | 5 | . ./settings/config.ps1 6 | 7 | if($CONFIG_exe_name) { 8 | $file = $CONFIG_exe_name 9 | } 10 | 11 | if($file -eq $null) { 12 | Write-Host "No filename given; please use the -file parameter to provide a target executable to archive.\n" 13 | exit 14 | } 15 | 16 | $extension = [IO.Path]::GetExtension($file) 17 | 18 | if ($extension -ne ".exe") { 19 | Write-Host "Filename provided not an executable! Please provide a .exe file as the target.\n" 20 | exit 21 | } 22 | 23 | $dir_name = "$CONFIG_exe_path\$((Get-Date).ToString('yyyy-MM-dd'))" 24 | 25 | if(Test-Path $CONFIG_exe_path\$dir_name) { 26 | } 27 | else { 28 | New-Item -ItemType Directory -Path $dir_name 29 | } 30 | 31 | if(Test-Path ..\..\CHANGELOG.md) { 32 | Copy-Item ..\..\CHANGELOG.md $CONFIG_exe_path\$dir_name 33 | } 34 | 35 | if(Test-Path $CONFIG_exe_path\$dir_name\$file) { 36 | Write-Host "File $file already exists in $dir_name! Overwrite?" 37 | 38 | $title = "Overwrite file?" 39 | 40 | $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", ` 41 | "Overwrite file $CONFIG_exe_path\$dir_name\$file.\n" 42 | 43 | $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", ` 44 | "Retain previously archived file.\n" 45 | 46 | $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no) 47 | 48 | $result = $host.ui.PromptForChoice($title, $message, $options, 0) 49 | 50 | switch ($result) 51 | { 52 | 0 { 53 | } 54 | 1 { 55 | exit 56 | } 57 | } 58 | } 59 | 60 | Copy-Item $CONFIG_exe_path\$file $CONFIG_exe_path\$dir_name\$file -force -------------------------------------------------------------------------------- /scripts/disable_edge_ui.ps1: -------------------------------------------------------------------------------- 1 | # Disable Edge UI 2 | # ------------------------- 3 | # Disables the new Windows Edge UI / other various UI settings 4 | 5 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name DontUsePowerShellOnWinX -Value 0 6 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name TaskbarSizeMove -Value 0 7 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name MMTaskbarEnabled -Value 0 8 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage' -Name OpenAtLogon -Value 0 9 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage' -Name MonitorOverride -Value 1 10 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage' -Name MakeAllAppsDefault -Value 1 11 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage' -Name DesktopFirst -Value 1 12 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage' -Name GlobalSearchInApps -Value 1 13 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer' -Name TaskbarNoMultimon -Value 1 14 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate' -Name DisableOSUpgrade -Value 1 15 | 16 | # Windows 8 17 | if (Test-Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUi') { 18 | } 19 | else { 20 | New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell' -Name 'EdgeUi' 21 | } 22 | 23 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUi' -Name DisableTLCorner -Value 1 24 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUi' -Name DisableTRCorner -Value 1 25 | 26 | if (Test-Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent') { 27 | } 28 | else { 29 | New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer' -Name 'Accent' 30 | } 31 | 32 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent' -Name MotionAccentId_v1.00 -Value 000000db 33 | 34 | # Windows 10 35 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search' -Name SearchboxTaskbarMode -Value 0 36 | Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name ShowTaskViewButton -Value 0 -------------------------------------------------------------------------------- /scripts/disable_firewall.ps1: -------------------------------------------------------------------------------- 1 | # disable_firewall.ps1 2 | # ------------------------- 3 | # Disables the Windows Firewall. 4 | 5 | Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False 6 | -------------------------------------------------------------------------------- /scripts/disable_screensaver.ps1: -------------------------------------------------------------------------------- 1 | # disable_screensaver.ps1 2 | # ------------------------- 3 | # Disables the screensaver from ever turning on. 4 | 5 | # Disable screensaver 6 | Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop\' -Name ScreenSaveActive -Value 1 7 | -------------------------------------------------------------------------------- /scripts/disable_windows_key.ps1: -------------------------------------------------------------------------------- 1 | # disable_windows_key.ps1 2 | # ------------------------- 3 | # Disables the windows keys. To enable them, go into the registry editor and remove the Scancode Map key in the directory below. 4 | 5 | Set-Property -path 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout\' -name 'Scancode Map' -propertytype REG_BINARY -value 00000000000000000300000000005BE000005CE000000000 -------------------------------------------------------------------------------- /scripts/disable_windows_update.ps1: -------------------------------------------------------------------------------- 1 | # disable_windows_update.ps1 2 | # ------------------------- 3 | # Configure Windows Update to never check for updates, and never bother the user to update. 4 | 5 | if ([environment]::OSVersion.Version.Major -lt 10) { 6 | $update_settings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings 7 | # 0 is not configured, 1 is disabled, 2 is notify before download, 3 is notify before installation, 4 is fully automatic 8 | $update_settings.NotificationLevel = 1 9 | $update_settings.Save() 10 | } 11 | 12 | if ([environment]::OSVersion.Version.Major -eq 10) { 13 | if(!(Test-Path 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate')) { 14 | New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\' -Name 'WindowsUpdate' 15 | } 16 | 17 | if(!(Test-Path 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU')) { 18 | New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate' -Name 'AU' 19 | } 20 | 21 | Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name "NoAutoUpdate" -Value 1 22 | } 23 | -------------------------------------------------------------------------------- /scripts/download_folder.ps1: -------------------------------------------------------------------------------- 1 | # download-from-bitbucket.ps1 2 | # ------------------------- 3 | # Downloads an object from bitbucket's downloads page. 4 | # 5 | # 6 | 7 | param ( 8 | [Parameter(Mandatory=$true)][string]$folder 9 | ) 10 | 11 | if(!(Test-Path ./settings/config.ps1)) { 12 | Write-Host "" 13 | Write-Host "Could not find configuration file! Please verify that it exists at config.ps1" 14 | exit 15 | } 16 | 17 | . ./settings/config.ps1 18 | 19 | & ./download_from_bitbucket.ps1 "$folder.tar.gz" 20 | 21 | & ./7za.exe e ./$folder.tar.gz 22 | & ./7za.exe x -aoa -ttar ./$folder.tar 23 | 24 | Remove-Item ./$folder.tar 25 | Remove-Item ./$folder.tar.gz -------------------------------------------------------------------------------- /scripts/download_from_bitbucket.ps1: -------------------------------------------------------------------------------- 1 | # download-from-bitbucket.ps1 2 | # ------------------------- 3 | # Downloads an object from bitbucket's downloads page. 4 | # 5 | # 6 | 7 | param ( 8 | [Parameter(Mandatory=$true)][string]$file 9 | ) 10 | 11 | if(!(Test-Path ./settings/config.ps1)) { 12 | Write-Host "" 13 | Write-Host "Could not find configuration file!" 14 | Write-Host "Please create a file /settings/config.ps1 with parameters $CONFIG_team_name and $CONFIG_project_name." 15 | exit 16 | } 17 | 18 | . ./settings/config.ps1 19 | 20 | & 'C:\Program Files\cURL\bin\curl.exe' -v -u $SECRET_username -L "https://api.bitbucket.org/2.0/repositories/$CONFIG_team_name/$CONFIG_project_name/downloads/$file" -o $file -------------------------------------------------------------------------------- /scripts/download_release.ps1: -------------------------------------------------------------------------------- 1 | # unpackage_new_release.ps1 2 | # ------------------------- 3 | # Unpackages the latest compiled Release from bitbucket to your computer. 4 | 5 | param ( 6 | [string]$file = "$((Get-Date).ToString('yyyy-MM-dd')).tar.gz" 7 | ) 8 | 9 | if(!(Test-Path ./settings/config.ps1)) { 10 | Write-Host "" 11 | Write-Host "Could not find configuration file! Please verify that it exists at config.ps1" 12 | exit 13 | } 14 | 15 | . ./settings/config.ps1 16 | 17 | & ./download_from_bitbucket.ps1 $file 18 | 19 | $dir_name = "$((Get-Date).ToString('yyyy-MM-dd'))" 20 | 21 | & ./7za.exe e ./$dir_name.tar.gz 22 | & ./7za.exe x -aoa -ttar ./$dir_name.tar 23 | 24 | Remove-Item ./$dir_name.tar 25 | Remove-Item ./$dir_name.tar.gz 26 | 27 | if(Test-Path $CONFIG_exe_path/$dir_name) { 28 | Remove-Item $CONFIG_exe_path/$dir_name 29 | } 30 | 31 | Move-Item ./$dir_name $CONFIG_exe_path/ -force 32 | 33 | Copy-Item $CONFIG_exe_path/$dir_name/$CONFIG_exe_name $CONFIG_exe_path/$CONFIG_exe_name -force 34 | 35 | & ./add_to_startup.ps1 -------------------------------------------------------------------------------- /scripts/enable_autologin.ps1: -------------------------------------------------------------------------------- 1 | # enable_autologin.ps1 2 | # ------------------------- 3 | # Enables automatic login without a username and password; either place the username and password in the configuration file or run this 4 | # in the powershell and enter them manually. 5 | 6 | param ( 7 | [string]$username = "", 8 | [string]$password = "" 9 | ) 10 | 11 | if($username -eq "") { 12 | . ./settings/config.ps1 13 | $username = $CONFIG_admin_username 14 | $password = $CONFIG_admin_password 15 | } 16 | 17 | # Autologin 18 | Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoAdminLogon -Value 1 19 | Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultDomainName -Value $env:computername 20 | Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultUserName -Value $username 21 | Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultPassword -Value $password 22 | -------------------------------------------------------------------------------- /scripts/install_chocolatey_development.ps1: -------------------------------------------------------------------------------- 1 | Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 2 | 3 | chocolatey feature enable -n allowGlobalConfirmation 4 | 5 | # web browsers 6 | choco install googlechrome 7 | 8 | # video 9 | choco install vlc 10 | choco install quicktime 11 | 12 | # text editors 13 | choco install atom 14 | 15 | # developer tools 16 | choco install git 17 | choco install visualstudio2017community 18 | choco install python --version 3.5.4 19 | python -m ensurepip 20 | choco install nodejs 21 | choco install meteor 22 | choco install arduino 23 | choco install cmake 24 | choco install kicad 25 | choco install ffmpeg 26 | 27 | # misc windows stuff 28 | choco install autohotkey.portable 29 | choco install 7zip 30 | choco install filezilla 31 | choco install teamviewer 32 | choco install wireshark 33 | choco install dropbox 34 | 35 | refreshenv 36 | -------------------------------------------------------------------------------- /scripts/install_chocolatey_production.ps1: -------------------------------------------------------------------------------- 1 | Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 2 | 3 | chocolatey feature enable -n allowGlobalConfirmation 4 | 5 | # web browsers 6 | choco install googlechrome 7 | 8 | # video 9 | choco install vlc 10 | choco install quicktime 11 | 12 | # text editors 13 | choco install atom 14 | 15 | # for cloning repos 16 | choco install git 17 | 18 | # for running C++ executables 19 | choco install vcredist2017 20 | 21 | # for running python scripts / downloading requirements 22 | choco install python --version 3.5.4 23 | python -m ensurepip 24 | 25 | # for running node programs 26 | choco install nodejs 27 | 28 | # misc windows stuff 29 | choco install autohotkey.portable 30 | choco install 7zip 31 | choco install filezilla 32 | choco install teamviewer 33 | choco install wireshark 34 | 35 | refreshenv 36 | -------------------------------------------------------------------------------- /scripts/launch_application_cycle.ps1: -------------------------------------------------------------------------------- 1 | # launch_application.ps1 2 | # ------------------------- 3 | # Cyclically starts the program; if the program ever closes then it will automatically reboot. 4 | 5 | $path = (Resolve-Path .\).Path 6 | 7 | . $path/settings/config.ps1 8 | 9 | & $path/$CONFIG_exe_path/$CONFIG_exe_name 10 | 11 | #Start-Process PowerShell.exe -arg ./launch_application.ps1 #-WindowStyle Hidden -------------------------------------------------------------------------------- /scripts/publish_folder.ps1: -------------------------------------------------------------------------------- 1 | # package_new_release.ps1 2 | # ------------------------- 3 | # Packages the latest compiled Release from your current computer, ready to deploy on a remote computer. 4 | 5 | param ( 6 | [Parameter(Mandatory=$true)][string]$folder, 7 | [Parameter(Mandatory=$true)][string]$archive_name 8 | ) 9 | 10 | if(!(Test-Path ./settings/config.ps1)) { 11 | Write-Host "" 12 | Write-Host "Could not find configuration file! Please verify that it exists at config.ps1" 13 | exit 14 | } 15 | 16 | . ./settings/config.ps1 17 | 18 | # Zip it up 19 | & 7z.exe a -ttar ./$archive_name.tar ./$folder 20 | & 7z.exe a ./$archive_name.tar.gz ./$archive_name.tar 21 | 22 | & ./publish_to_bitbucket.ps1 ./$archive_name.tar.gz 23 | 24 | Remove-Item ./$archive_name.tar 25 | Remove-Item ./$archive_name.tar.gz -------------------------------------------------------------------------------- /scripts/publish_release.ps1: -------------------------------------------------------------------------------- 1 | # package_new_release.ps1 2 | # ------------------------- 3 | # Packages the latest compiled Release from your current computer, ready to deploy on a remote computer. 4 | 5 | if(!(Test-Path ./settings/config.ps1)) { 6 | Write-Host "" 7 | Write-Host "Could not find configuration file! Please verify that it exists at config.ps1" 8 | exit 9 | } 10 | 11 | . ./settings/config.ps1 12 | 13 | # Copy executable 14 | # Copy-Item ${CONFIG_release_path}/${CONFIG_exe_name} $CONFIG_exe_path 15 | 16 | # Archive the release into a folder. 17 | & ./archive_executable.ps1 18 | 19 | $dir_name = "$((Get-Date).ToString('yyyy-MM-dd'))" 20 | 21 | # Zip it up 22 | & ./7za.exe a -ttar ./$dir_name.tar $CONFIG_exe_path/$dir_name 23 | & ./7za.exe a ./$dir_name.tar.gz ./$dir_name.tar 24 | 25 | & ./publish_to_bitbucket.ps1 ./$dir_name.tar.gz 26 | 27 | Remove-Item ./$dir_name.tar 28 | Remove-Item ./$dir_name.tar.gz 29 | -------------------------------------------------------------------------------- /scripts/publish_to_bitbucket.ps1: -------------------------------------------------------------------------------- 1 | # download-from-bitbucket.ps1 2 | # ------------------------- 3 | # Downloads an object from bitbucket's downloads page. 4 | # 5 | # 6 | 7 | param ( 8 | [Parameter(Mandatory=$true)][string]$file 9 | ) 10 | 11 | if(!(Test-Path ./settings/config.ps1)) { 12 | Write-Host "" 13 | Write-Host "Could not find configuration file!" 14 | Write-Host "Please create a file /settings/config.ps1 with parameters $CONFIG_team_name and $CONFIG_project_name." 15 | exit 16 | } 17 | 18 | . ./settings/config.ps1 19 | 20 | & 'C:\Program Files\cURL\bin\curl.exe' -v -u $SECRET_username -X POST -L "https://api.bitbucket.org/2.0/repositories/$CONFIG_team_name/$CONFIG_project_name/downloads" -F files=`@$file -------------------------------------------------------------------------------- /scripts/set_admin_username.ps1: -------------------------------------------------------------------------------- 1 | # set_admin_username.ps1 2 | # ------------------------- 3 | # Changes the current admin user/pass to a new set. 4 | 5 | param ( 6 | [Parameter(Mandatory=$true)][string]$username = $null, 7 | [Parameter(Mandatory=$true)][string]$password = $null 8 | ) 9 | 10 | $oldAdminuserName = "sdf" # change this if necessary 11 | 12 | if(([Environment]::UserName -eq $oldAdminUserName) -and ([Environment]::UserName -ne $username)) { 13 | $adminUser = [ADSI]"WinNT://./$oldAdminUserName,user" 14 | $adminUser.psbase.rename($username) 15 | $adminUser.SetPassword($password) 16 | $adminUser.setInfo() 17 | } -------------------------------------------------------------------------------- /scripts/set_background.ps1: -------------------------------------------------------------------------------- 1 | $signature = @" 2 | [DllImport("user32.dll")] 3 | public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); 4 | [DllImport("user32.dll")] 5 | public static extern bool ShowWindow(IntPtr hWnd,int nCmdShow); 6 | "@ 7 | 8 | $icons = Add-Type -MemberDefinition $signature -Name Win32Window ` 9 | -Namespace ScriptFanatic.WinAPI -passThru 10 | 11 | $hWnd=$icons::FindWindow("Progman","Program Manager") 12 | 13 | function Hide-DesktopIcons() { 14 | $null = $icons::ShowWindow($hWnd,0) 15 | } 16 | 17 | function Show-DesktopIcons() { 18 | $null = $icons::ShowWindow($hWnd,5) 19 | } 20 | 21 | function Set-WallPaper($Value) { 22 | Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value 23 | rundll32.exe user32.dll, UpdatePerUserSystemParameters 24 | } 25 | 26 | . ./settings/config.ps1 27 | 28 | Set-Wallpaper -value $CONFIG_wallpaper_path 29 | 30 | Hide-DesktopIcons() -------------------------------------------------------------------------------- /scripts/set_computer_name.ps1: -------------------------------------------------------------------------------- 1 | # set_computer_name.ps1 2 | # ------------------------- 3 | # Renames the computer. 4 | param ( 5 | [string]$computername = $null 6 | ) 7 | 8 | if ($computername -eq $null) { 9 | . ./settings/config.ps1 10 | $computername = $CONFIG_computer_name 11 | } 12 | 13 | Rename-Computer $computername -------------------------------------------------------------------------------- /scripts/set_ip.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morphogencc/ofxWindowsSetup/857c8b6f0203fd2c39044a818d3868cfffae62f1/scripts/set_ip.ps1 -------------------------------------------------------------------------------- /scripts/set_power_settings.ps1: -------------------------------------------------------------------------------- 1 | # Power Settings 2 | 3 | $path = (Resolve-Path .\).Path 4 | 5 | powercfg /IMPORT $path/settings/power_settings.pow -------------------------------------------------------------------------------- /scripts/set_scheduled_reboot.ps1: -------------------------------------------------------------------------------- 1 | # set_scheduled_reboot.ps1 2 | # ------------------------- 3 | # Create a nightly task that reboots the computer at a given time. 4 | 5 | param ( 6 | [string]$rebootTime = "" 7 | ) 8 | 9 | if($rebootTime -eq "") { 10 | . ./settings/config.ps1 11 | $rebootTime = $CONFIG_reboot_time 12 | } 13 | 14 | $taskName = "Nightly System Reboot" 15 | $task = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue 16 | 17 | if (!$task) { 18 | $action = New-ScheduledTaskAction -Execute "C:\WINDOWS\System32\shutdown.exe -r -f" 19 | $trigger = New-ScheduledTaskTrigger -Daily -AT $rebootTime 20 | $settings = New-ScheduledTaskSettingsSet 21 | $inputObject = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings 22 | Register-ScheduledTask -TaskName $taskName -InputObject $inputObject 23 | } -------------------------------------------------------------------------------- /scripts/set_timezone.ps1: -------------------------------------------------------------------------------- 1 | # set_timezone.ps1 2 | # ------------------------- 3 | # Sets the timezone, and a time-resync with internet servers on every user logon. 4 | 5 | . ./settings/config.ps1 6 | 7 | & "$env:windir\system32\tzutil.exe" /s $CONFIG_timezone 8 | 9 | $taskName1 = "Resync Time 1-2" 10 | $task1 = Get-ScheduledTask -TaskName $taskName1 -ErrorAction SilentlyContinue 11 | 12 | if (!$task1) { 13 | $action = New-ScheduledTaskAction -Execute "C:\Windows\System32\sc.exe" -Argument "start w32time task_started" 14 | $trigger = New-ScheduledTaskTrigger -AtLogOn 15 | $settings = New-ScheduledTaskSettingsSet 16 | $principal = New-ScheduledTaskPrincipal -UserId "$($env:USERDOMAIN)\$($env:USERNAME)" -LogonType ServiceAccount -RunLevel Highest 17 | Register-ScheduledTask -TaskName $taskName1 -Description "Synchronize time at startup." -Action $action -Trigger $trigger -Settings $settings -Principal $principal 18 | } 19 | 20 | $taskName = "Resync Time 2-2" 21 | $task = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue 22 | 23 | if (!$task) { 24 | $action = New-ScheduledTaskAction -Execute "C:\Windows\System32\w32tm.exe" -Argument "/resync" 25 | $trigger = New-ScheduledTaskTrigger -AtLogOn 26 | $settings = New-ScheduledTaskSettingsSet 27 | $principal = New-ScheduledTaskPrincipal -UserId "$($env:USERDOMAIN)\$($env:USERNAME)" -LogonType ServiceAccount -RunLevel Highest 28 | Register-ScheduledTask -TaskName $taskName -Description "Synchronize time at startup." -Action $action -Trigger $trigger -Settings $settings -Principal $principal 29 | } -------------------------------------------------------------------------------- /scripts/settings/config.ps1: -------------------------------------------------------------------------------- 1 | # Local Settings 2 | $CONFIG_computer_name = hostname 3 | $CONFIG_admin_username = "sdf" 4 | $CONFIG_admin_password = "changeme" 5 | 6 | # Ethernet Settings 7 | $CONFIG_network_adapter="Ethernet" 8 | $CONFIG_network_dhcp_enabled=$FALSE 9 | $CONFIG_network_ip_address="192.168.0.168" 10 | $CONFIG_network_subnet_mask=24 11 | $CONFIG_network_gateway="192.168.0.1" 12 | $CONFIG_network_dns="8.8.8.8" 13 | $CONFIG_network_dns_alt="8.8.4.4" 14 | 15 | # Path to wallpaper image 16 | $CONFIG_wallpaper_path = "../runtime/data/images/startup/startup.jpg" 17 | 18 | # Time-related Parameters 19 | $CONFIG_timezone = "Eastern Standard Time" 20 | $CONFIG_reboot_time = "3:00" -------------------------------------------------------------------------------- /scripts/settings/power_settings.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morphogencc/ofxWindowsSetup/857c8b6f0203fd2c39044a818d3868cfffae62f1/scripts/settings/power_settings.conf -------------------------------------------------------------------------------- /scripts/settings/power_settings.pow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morphogencc/ofxWindowsSetup/857c8b6f0203fd2c39044a818d3868cfffae62f1/scripts/settings/power_settings.pow -------------------------------------------------------------------------------- /set_configuration.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Disabling Windows Edge UI and other unnecessary UI..." 2 | ./scripts/disable_edge_ui.ps1 3 | 4 | Write-Host "Disabling Window Firewall..." 5 | ./scripts/disable_firewall.ps1 6 | 7 | Write-Host "Disabling Screensaver..." 8 | ./scripts/disable_screensaver.ps1 9 | 10 | Write-Host "Disabling Windows Update..." 11 | ./scripts/disable_windows_update.ps1 12 | 13 | Write-Host "Enabling autologin..." 14 | ./scripts/enable_autologin.ps1 15 | 16 | Write-Host "Setting computer name..." 17 | ./scripts/set_computer_name.ps1 18 | 19 | Write-Host "Setting IP Address..." 20 | ./scripts/set_ip.ps1 21 | 22 | Write-Host "Setting power settings..." 23 | ./scripts/set_power_settings.ps1 24 | 25 | Write-Host "Setting scheduled reboot..." 26 | ./scripts/set_scheduled_reboot.ps1 27 | 28 | Write-Host "Setting the time zone..." 29 | ./scripts/set_timezone.ps1 -------------------------------------------------------------------------------- /setup_development.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Running configuration for a PRODUCTION Computer..." 2 | 3 | ./run_configuration.ps1 4 | 5 | ./install_chocolatey_development.ps1 -------------------------------------------------------------------------------- /setup_production.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Running configuration for a PRODUCTION Computer..." 2 | 3 | ./run_configuration.ps1 4 | 5 | ./install_chocolatey_production.ps1 --------------------------------------------------------------------------------