Admin tools on View servers

Install admin tools using PowerShell on Windows 2012 server
pull/45/head
DemitasseNZ 2016-04-16 20:41:10 +12:00
parent 90c0964878
commit f5858dc583
5 changed files with 12 additions and 6 deletions

View File

@ -23,6 +23,8 @@ If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environm
Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs
Write-BuildLog "Disabling screen saver" Write-BuildLog "Disabling screen saver"
set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0
Write-BuildLog "Install admin tools"
Add-WindowsFeature RSAT-Feature-Tools,RSAT-DHCP,RSAT-DNS-Server,RSAT-AD-AdminCenter
} }
$Files = get-childitem "b:\view$viewinstall" $Files = get-childitem "b:\view$viewinstall"
for ($i=0; $i -lt $files.Count; $i++) { for ($i=0; $i -lt $files.Count; $i++) {
@ -86,7 +88,7 @@ if (([bool]($emailto -as [Net.Mail.MailAddress])) -and ($SmtpServer -ne "none"))
$Summary += "The build log is attached`r`n" $Summary += "The build log is attached`r`n"
$mailmessage.Subject = "$env:computername VM build finished" $mailmessage.Subject = "$env:computername VM build finished"
$mailmessage.Body = $Summary $mailmessage.Body = $Summary
$attach = new-object Net.Mail.Attachment("C:\buildlog.txt", 'text/plain') $attach = new-object Net.Mail.Attachment("C:\buildlog.txt")
$mailmessage.Attachments.Add($attach) $mailmessage.Attachments.Add($attach)
$message.Attachments.Add($attach) $message.Attachments.Add($attach)
$SMTPClient.Send($mailmessage) $SMTPClient.Send($mailmessage)

View File

@ -22,6 +22,8 @@ If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environm
Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs
Write-BuildLog "Disabling screen saver" Write-BuildLog "Disabling screen saver"
set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0
Write-BuildLog "Install admin tools"
Add-WindowsFeature RSAT-Feature-Tools,RSAT-DHCP,RSAT-DNS-Server,RSAT-AD-AdminCenter
} }
if (Test-Path "C:\VMware-view*") { if (Test-Path "C:\VMware-view*") {
$Files = get-childitem "C:\" $Files = get-childitem "C:\"
@ -91,7 +93,7 @@ if (([bool]($emailto -as [Net.Mail.MailAddress])) -and ($SmtpServer -ne "none"))
$Summary += "The build log is attached`r`n" $Summary += "The build log is attached`r`n"
$mailmessage.Subject = "$env:computername VM build finished" $mailmessage.Subject = "$env:computername VM build finished"
$mailmessage.Body = $Summary $mailmessage.Body = $Summary
$attach = new-object Net.Mail.Attachment("C:\buildlog.txt", 'text/plain') $attach = new-object Net.Mail.Attachment("C:\buildlog.txt")
$mailmessage.Attachments.Add($attach) $mailmessage.Attachments.Add($attach)
$message.Attachments.Add($attach) $message.Attachments.Add($attach)
$SMTPClient.Send($mailmessage) $SMTPClient.Send($mailmessage)

View File

@ -453,7 +453,7 @@ if (Test-Path "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe")
exit exit
} }
} }
If (((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -le 62)) { If (((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -le 61)) {
Write-BuildLog "Doing Windows Server 2008 specific build actions" Write-BuildLog "Doing Windows Server 2008 specific build actions"
if (Test-Path B:\sqlmsssetup.exe) { if (Test-Path B:\sqlmsssetup.exe) {
Rename-Item B:\sqlmsssetup.exe SQLManagementStudio_x64_ENU.exe Rename-Item B:\sqlmsssetup.exe SQLManagementStudio_x64_ENU.exe
@ -571,7 +571,7 @@ if (($vmtools) -and (-Not (Test-Path "C:\Program Files\VMware\VMware Tools\VMwar
$Summary += "The build log is attached`r`n" $Summary += "The build log is attached`r`n"
$mailmessage.Subject = "$env:computername VM build finished" $mailmessage.Subject = "$env:computername VM build finished"
$mailmessage.Body = $Summary $mailmessage.Body = $Summary
$attach = new-object Net.Mail.Attachment("C:\buildlog.txt", 'text/plain') $attach = new-object Net.Mail.Attachment("C:\buildlog.txt")
$mailmessage.Attachments.Add($attach) $mailmessage.Attachments.Add($attach)
$message.Attachments.Add($attach) $message.Attachments.Add($attach)
$SMTPClient.Send($mailmessage) $SMTPClient.Send($mailmessage)

View File

@ -22,6 +22,8 @@ If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environm
Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs
Write-BuildLog "Disabling screen saver" Write-BuildLog "Disabling screen saver"
set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0
Write-BuildLog "Install admin tools"
Add-WindowsFeature RSAT-Feature-Tools,RSAT-DHCP,RSAT-DNS-Server,RSAT-AD-AdminCenter
} }
$Files = get-childitem "b:\view$viewinstall" $Files = get-childitem "b:\view$viewinstall"
for ($i=0; $i -lt $files.Count; $i++) { for ($i=0; $i -lt $files.Count; $i++) {
@ -81,7 +83,7 @@ if (([bool]($emailto -as [Net.Mail.MailAddress])) -and ($SmtpServer -ne "none"))
$Summary += "The build log is attached`r`n" $Summary += "The build log is attached`r`n"
$mailmessage.Subject = "$env:computername VM build finished" $mailmessage.Subject = "$env:computername VM build finished"
$mailmessage.Body = $Summary $mailmessage.Body = $Summary
$attach = new-object Net.Mail.Attachment("C:\buildlog.txt", 'text/plain') $attach = new-object Net.Mail.Attachment("C:\buildlog.txt")
$mailmessage.Attachments.Add($attach) $mailmessage.Attachments.Add($attach)
$message.Attachments.Add($attach) $message.Attachments.Add($attach)
$SMTPClient.Send($mailmessage) $SMTPClient.Send($mailmessage)

View File

@ -639,7 +639,7 @@ if (Test-Path B:\VMTools\setup64.exe) {
$Summary += "The build log is attached`r`n" $Summary += "The build log is attached`r`n"
$mailmessage.Subject = "$env:computername VM build finished" $mailmessage.Subject = "$env:computername VM build finished"
$mailmessage.Body = $Summary $mailmessage.Body = $Summary
$attach = new-object Net.Mail.Attachment("C:\buildlog.txt", 'text/plain') $attach = new-object Net.Mail.Attachment("C:\buildlog.txt")
$mailmessage.Attachments.Add($attach) $mailmessage.Attachments.Add($attach)
$SMTPClient.Send($mailmessage) $SMTPClient.Send($mailmessage)
} }