parent
9664df6899
commit
889b323fc1
@ -0,0 +1,49 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
require "date"
|
||||
require "fileutils"
|
||||
|
||||
Vagrant.require_version ">= 1.6.2"
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
#config.vm.define "gheis-" + DateTime.now.strftime("%Y-%m-%d-%H-%M-%S")
|
||||
config.vm.define "tgirl-2015-11-20"
|
||||
config.vm.box = "wintriallab-windows_10_x86"
|
||||
config.vm.communicator = "winrm"
|
||||
|
||||
config.vm.hostname = "tgirl"
|
||||
|
||||
# Admin user name and password
|
||||
config.winrm.username = "vagrant"
|
||||
config.winrm.password = "V@grant123"
|
||||
|
||||
config.vm.guest = :windows
|
||||
config.windows.halt_timeout = 15
|
||||
|
||||
config.vm.network :forwarded_port, guest: 3389, host: 33389, id: "rdp", auto_correct: true
|
||||
|
||||
config.vm.provider :virtualbox do |v, override|
|
||||
#v.gui = true
|
||||
v.customize ["modifyvm", :id, "--memory", 2048]
|
||||
v.customize ["modifyvm", :id, "--cpus", 2]
|
||||
v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
|
||||
v.customize ["modifyvm", :id, "--accelerate2dvideo", "on"]
|
||||
v.customize ["modifyvm", :id, "--vram", 128]
|
||||
v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
|
||||
v.customize ["modifyvm", :id, "--draganddrop", "bidirectional"]
|
||||
end
|
||||
|
||||
begin
|
||||
Dir.mkdir('./synced')
|
||||
rescue SystemCallError
|
||||
$stderr.print "Synced directory already exists...\r\n"
|
||||
end
|
||||
|
||||
FileUtils.cp "../../scripts/wintriallab-postinstall.psm1", "./synced/"
|
||||
FileUtils.cp "./tgirl-postinstall.ps1", "./synced/"
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
config.vm.synced_folder "./synced", "/marionettist", create: true
|
||||
|
||||
config.vm.provision "shell", inline: "C:/marionettist/tgirl-postinstall.ps1"
|
||||
end
|
@ -0,0 +1,58 @@
|
||||
[cmdletbinding()] param(
|
||||
[string] $newUsername = "mrled",
|
||||
[string] $newPassword = "boggy slab st droop speck"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# REMINDER: This runs under the vagrant account, NOT under the account of the user I'll use to log in
|
||||
|
||||
Get-Module |? -Property Name -match "wintriallab-postinstall" | Remove-Module
|
||||
Import-Module $PSScriptRoot\wintriallab-postinstall.psm1
|
||||
|
||||
Invoke-ScriptblockAndCatch -scriptBlock {
|
||||
|
||||
# Create my day-to-day user
|
||||
Add-LocalSamUser -userName "$newUsername" -password $newPassword
|
||||
Add-LocalSamUserToGroup -userName "$newUsername" -groupName "Administrators"
|
||||
Set-PasswordExpiry -accountName "$newUsername" -disable
|
||||
|
||||
$secureNewPassword = ConvertTo-SecureString -String $newPassword -Force -AsPlainText
|
||||
$newAccountCreds = New-Object System.Management.Automation.PSCredential $newUsername,$secureNewPassword
|
||||
|
||||
# Install apps
|
||||
$chocolateyPackages = @(
|
||||
"dropbox"
|
||||
)
|
||||
$chocolateyPackages |% { Invoke-ExpressionEx "choco install --yes '$_'" }
|
||||
|
||||
Invoke-Command -ComputerName localhost -Creds $newAccountCreds -EnableNetworkAccess -ScriptBlock {
|
||||
Import-Module C:\vagrant\wintriallab-postinstall.psm1
|
||||
|
||||
$suoParams = @{
|
||||
ShowHiddenFiles = $true
|
||||
ShowFileExtensions = $true
|
||||
ShowStatusBar = $true
|
||||
DisableSharingWizard = $true
|
||||
EnablePSOnWinX = $true
|
||||
EnableQuickEdit = $true
|
||||
DisableSystrayHide = $true
|
||||
DisableIEFirstRunCustomize = $true
|
||||
}
|
||||
Set-UserOptions @suoParams
|
||||
|
||||
try {
|
||||
$ErrorActionPreference = "Continue"
|
||||
Set-PinnedApplication -Action UnpinFromTaskbar -Filepath "C:\Program Files\WindowsApps\Microsoft.WindowsStore_2015.10.5.0_x86__8wekyb3d8bbwe\WinStore.Mobile.exe" -ErrorAction Continue
|
||||
Set-PinnedApplication -Action PinToTaskbar -Filepath "${env:ProgramFiles}\ConEmu\ConEmu.exe"
|
||||
#Set-PinnedApplication -Action PinToTaskbar -Filepath "${env:SystemRoot}\system32\eventvwr.msc"
|
||||
$UserPinnedTaskBar = "${env:AppData}\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
||||
if (test-path "$UserPinnedTaskBar\Server Manager.lnk") { rm "$UserPinnedTaskBar\Server Manager.lnk" }
|
||||
}
|
||||
catch {}
|
||||
finally {
|
||||
$ErrorActionPreference = "Stop"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in new issue