Initial
This commit is contained in:
80
01_Config/BGInfo.ps1
Normal file
80
01_Config/BGInfo.ps1
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
|
||||||
|
A script used to download, install and configure the latest BgInfo version on a Windows Server 2016 or 2019.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
|
||||||
|
A script used to download, install and configure the latest BgInfo version (v4.27) on a Windows Server 2016 or 2019. The BgInfo folder will be created on the C: drive if the folder does not already exist.
|
||||||
|
Then the latest BgInfo.zip file will be downloaded and extracted in the BgInfo folder. The LogonBgi.zip file which holds the preferred settings will also be downloaded and extracted to the BgInfo folder.
|
||||||
|
After extraction both .zip files will be deleted. A registry key (regkey) to AutoStart the BgInfo tool in combination with the logon.bgi config file will be created. At the end of the script BgInfo will
|
||||||
|
be started for the first time and the PowerShell window will be closed.
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
|
||||||
|
File Name: BgInfo_Automated_Windows_Server_2016_2019.ps1
|
||||||
|
Created: 08/09/2019
|
||||||
|
Last modified: 13/09/2019
|
||||||
|
Author: Wim Matthyssen
|
||||||
|
PowerShell: 5.1 or above
|
||||||
|
Requires: -RunAsAdministrator
|
||||||
|
OS: Windows Server 2016 and Windows Server 2019
|
||||||
|
Version: 2.2
|
||||||
|
Action: Change variables were needed to fit your needs
|
||||||
|
Disclaimer: This script is provided "As Is" with no warranties.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
|
||||||
|
.\BgInfo_Automated_Windows_Server_2016_2019.ps1
|
||||||
|
|
||||||
|
.LINK
|
||||||
|
|
||||||
|
https://tinyurl.com/y3wmsh7o
|
||||||
|
#>
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
|
||||||
|
$bgInfoFolder = "C:\BgInfo"
|
||||||
|
$bgInfoFolderContent = $bgInfoFolder + "\*"
|
||||||
|
$itemType = "Directory"
|
||||||
|
$bgInfoUrl = "https://download.sysinternals.com/files/BGInfo.zip"
|
||||||
|
$bgInfoZip = "C:\BgInfo\BGInfo.zip"
|
||||||
|
$bgInfoEula = "C:\BgInfo\Eula.txt"
|
||||||
|
$logonBgiUrl = "https://tinyurl.com/yxlxbgun"
|
||||||
|
$logonBgiZip = "C:\BgInfo\LogonBgi.zip"
|
||||||
|
$bgInfoRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
|
||||||
|
$bgInfoRegKey = "BgInfo"
|
||||||
|
$bgInfoRegType = "String"
|
||||||
|
$bgInfoRegKeyValue = "C:\BgInfo\Bginfo64.exe C:\BgInfo\logon.bgi /timer:0 /nolicprompt"
|
||||||
|
$regKeyExists = (Get-Item $bgInfoRegPath -EA Ignore).Property -contains $bgInfoRegkey
|
||||||
|
$writeEmptyLine = "`n"
|
||||||
|
$writeSeperator = " - "
|
||||||
|
$time = Get-Date -UFormat "%A %m/%d/%Y %R"
|
||||||
|
$foregroundColor1 = "Yellow"
|
||||||
|
$foregroundColor2 = "Red"
|
||||||
|
|
||||||
|
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Create BgInfo Registry Key to AutoStart
|
||||||
|
|
||||||
|
If ($regKeyExists -eq $True){Write-Host ($writeEmptyLine + "BgInfo regkey exists, script wil go on" + $writeSeperator + $time)`
|
||||||
|
-foregroundcolor $foregroundColor2 $writeEmptyLine
|
||||||
|
}Else{
|
||||||
|
New-ItemProperty -Path $bgInfoRegPath -Name $bgInfoRegkey -PropertyType $bgInfoRegType -Value $bgInfoRegkeyValue
|
||||||
|
Write-Host ($writeEmptyLine + "# BgInfo regkey added" + $writeSeperator + $time)`
|
||||||
|
-foregroundcolor $foregroundColor1 $writeEmptyLine}
|
||||||
|
|
||||||
|
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Run BgInfo
|
||||||
|
|
||||||
|
C:\BgInfo\Bginfo64.exe C:\BgInfo\logon.bgi /timer:0 /nolicprompt
|
||||||
|
|
||||||
|
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Exit PowerShell window 2 seconds after completion
|
||||||
|
|
||||||
|
Start-Sleep 2
|
||||||
|
stop-process -Id $PID
|
||||||
|
|
||||||
|
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
10
01_Config/Network.ps1
Normal file
10
01_Config/Network.ps1
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Networkconfiguration
|
||||||
|
|
||||||
|
$ConfigAdapterName = Get-NetAdapter | where MacAddress -eq "1MACAddress"
|
||||||
|
|
||||||
|
Rename-NetAdapter -Name $ConfigAdapterName.name -NewName "1NetworkAdapterName"
|
||||||
|
Set-NetIPInterface -InterfaceIndex $ConfigAdapterName.ifIndex -Dhcp Disabled
|
||||||
|
|
||||||
|
New-NetIPAddress -InterfaceIndex $ConfigAdapterName.ifIndex -IPAddress 1IPDomain -DefaultGateway 1DefaultGW -PrefixLength 24
|
||||||
|
Set-DNSClientServerAddress -InterfaceIndex $ConfigAdapterName.ifIndex -ServerAddresses ("1DNSServer1","1DNSServer2")
|
||||||
|
Set-DnsClientGlobalSetting -SuffixSearchList @("1DNSDomain")
|
||||||
80
01_Config/SRV-WSUS-01/BGInfo-SRV-WSUS-01.ps1
Normal file
80
01_Config/SRV-WSUS-01/BGInfo-SRV-WSUS-01.ps1
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
|
||||||
|
A script used to download, install and configure the latest BgInfo version on a Windows Server 2016 or 2019.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
|
||||||
|
A script used to download, install and configure the latest BgInfo version (v4.27) on a Windows Server 2016 or 2019. The BgInfo folder will be created on the C: drive if the folder does not already exist.
|
||||||
|
Then the latest BgInfo.zip file will be downloaded and extracted in the BgInfo folder. The LogonBgi.zip file which holds the preferred settings will also be downloaded and extracted to the BgInfo folder.
|
||||||
|
After extraction both .zip files will be deleted. A registry key (regkey) to AutoStart the BgInfo tool in combination with the logon.bgi config file will be created. At the end of the script BgInfo will
|
||||||
|
be started for the first time and the PowerShell window will be closed.
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
|
||||||
|
File Name: BgInfo_Automated_Windows_Server_2016_2019.ps1
|
||||||
|
Created: 08/09/2019
|
||||||
|
Last modified: 13/09/2019
|
||||||
|
Author: Wim Matthyssen
|
||||||
|
PowerShell: 5.1 or above
|
||||||
|
Requires: -RunAsAdministrator
|
||||||
|
OS: Windows Server 2016 and Windows Server 2019
|
||||||
|
Version: 2.2
|
||||||
|
Action: Change variables were needed to fit your needs
|
||||||
|
Disclaimer: This script is provided "As Is" with no warranties.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
|
||||||
|
.\BgInfo_Automated_Windows_Server_2016_2019.ps1
|
||||||
|
|
||||||
|
.LINK
|
||||||
|
|
||||||
|
https://tinyurl.com/y3wmsh7o
|
||||||
|
#>
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
|
||||||
|
$bgInfoFolder = "C:\BgInfo"
|
||||||
|
$bgInfoFolderContent = $bgInfoFolder + "\*"
|
||||||
|
$itemType = "Directory"
|
||||||
|
$bgInfoUrl = "https://download.sysinternals.com/files/BGInfo.zip"
|
||||||
|
$bgInfoZip = "C:\BgInfo\BGInfo.zip"
|
||||||
|
$bgInfoEula = "C:\BgInfo\Eula.txt"
|
||||||
|
$logonBgiUrl = "https://tinyurl.com/yxlxbgun"
|
||||||
|
$logonBgiZip = "C:\BgInfo\LogonBgi.zip"
|
||||||
|
$bgInfoRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
|
||||||
|
$bgInfoRegKey = "BgInfo"
|
||||||
|
$bgInfoRegType = "String"
|
||||||
|
$bgInfoRegKeyValue = "C:\BgInfo\Bginfo64.exe C:\BgInfo\logon.bgi /timer:0 /nolicprompt"
|
||||||
|
$regKeyExists = (Get-Item $bgInfoRegPath -EA Ignore).Property -contains $bgInfoRegkey
|
||||||
|
$writeEmptyLine = "`n"
|
||||||
|
$writeSeperator = " - "
|
||||||
|
$time = Get-Date -UFormat "%A %m/%d/%Y %R"
|
||||||
|
$foregroundColor1 = "Yellow"
|
||||||
|
$foregroundColor2 = "Red"
|
||||||
|
|
||||||
|
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Create BgInfo Registry Key to AutoStart
|
||||||
|
|
||||||
|
If ($regKeyExists -eq $True){Write-Host ($writeEmptyLine + "BgInfo regkey exists, script wil go on" + $writeSeperator + $time)`
|
||||||
|
-foregroundcolor $foregroundColor2 $writeEmptyLine
|
||||||
|
}Else{
|
||||||
|
New-ItemProperty -Path $bgInfoRegPath -Name $bgInfoRegkey -PropertyType $bgInfoRegType -Value $bgInfoRegkeyValue
|
||||||
|
Write-Host ($writeEmptyLine + "# BgInfo regkey added" + $writeSeperator + $time)`
|
||||||
|
-foregroundcolor $foregroundColor1 $writeEmptyLine}
|
||||||
|
|
||||||
|
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Run BgInfo
|
||||||
|
|
||||||
|
C:\BgInfo\Bginfo64.exe C:\BgInfo\logon.bgi /timer:0 /nolicprompt
|
||||||
|
|
||||||
|
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Exit PowerShell window 2 seconds after completion
|
||||||
|
|
||||||
|
Start-Sleep 2
|
||||||
|
stop-process -Id $PID
|
||||||
|
|
||||||
|
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
10
01_Config/SRV-WSUS-01/Network-SRV-WSUS-01.ps1
Normal file
10
01_Config/SRV-WSUS-01/Network-SRV-WSUS-01.ps1
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Networkconfiguration
|
||||||
|
|
||||||
|
$ConfigAdapterName = Get-NetAdapter | where MacAddress -eq "00-15-5D-01-10-6D"
|
||||||
|
|
||||||
|
Rename-NetAdapter -Name $ConfigAdapterName.name -NewName "Primary Adapter"
|
||||||
|
Set-NetIPInterface -InterfaceIndex $ConfigAdapterName.ifIndex -Dhcp Disabled
|
||||||
|
|
||||||
|
New-NetIPAddress -InterfaceIndex $ConfigAdapterName.ifIndex -IPAddress 192.168.10.15 -DefaultGateway 192.168.10.1 -PrefixLength 24
|
||||||
|
Set-DNSClientServerAddress -InterfaceIndex $ConfigAdapterName.ifIndex -ServerAddresses ("192.168.10.11","192.168.10.10")
|
||||||
|
Set-DnsClientGlobalSetting -SuffixSearchList @("schwab.local")
|
||||||
122
01_Config/SRV-WSUS-01/Unattend-SRV-WSUS-01.xml
Normal file
122
01_Config/SRV-WSUS-01/Unattend-SRV-WSUS-01.xml
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||||
|
<servicing>
|
||||||
|
<package action="configure">
|
||||||
|
<assemblyIdentity name="Package_for_KB3192137" version="10.0.1.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="" />
|
||||||
|
</package>
|
||||||
|
<package action="configure">
|
||||||
|
<assemblyIdentity name="Package_for_KB3211320" version="10.0.1.1" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="" />
|
||||||
|
</package>
|
||||||
|
</servicing>
|
||||||
|
<settings pass="windowsPE">
|
||||||
|
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<InputLocale>eu-US</InputLocale>
|
||||||
|
<SystemLocale>eu-US</SystemLocale>
|
||||||
|
<UILanguage>eu-US</UILanguage>
|
||||||
|
<UILanguageFallback>eu-US</UILanguageFallback>
|
||||||
|
<UserLocale>de-CH</UserLocale>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<UserData>
|
||||||
|
<AcceptEula>true</AcceptEula>
|
||||||
|
<FullName>Local-Admin</FullName>
|
||||||
|
</UserData>
|
||||||
|
<EnableFirewall>true</EnableFirewall>
|
||||||
|
<EnableNetwork>true</EnableNetwork>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
<settings pass="generalize">
|
||||||
|
<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<SkipRearm>1</SkipRearm>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
<settings pass="specialize">
|
||||||
|
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<InputLocale>en-US</InputLocale>
|
||||||
|
<SystemLocale>en-US</SystemLocale>
|
||||||
|
<UILanguage>en-US</UILanguage>
|
||||||
|
<UILanguageFallback>en-US</UILanguageFallback>
|
||||||
|
<UserLocale>de-CH</UserLocale>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<SkipAutoActivation>true</SkipAutoActivation>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-SQMApi" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<CEIPEnabled>0</CEIPEnabled>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<ComputerName>SRV-WSUS-01</ComputerName>
|
||||||
|
<ProductKey>TMJ3Y-NTRTM-FJYXT-T22BY-CWG3J</ProductKey>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<fDenyTSConnections>false</fDenyTSConnections>
|
||||||
|
</component>
|
||||||
|
<component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<FirewallGroups>
|
||||||
|
<FirewallGroup wcm:action="add" wcm:keyValue="1">
|
||||||
|
<Active>true</Active>
|
||||||
|
<Group>Remote Desktop</Group>
|
||||||
|
<Profile>all</Profile>
|
||||||
|
</FirewallGroup>
|
||||||
|
</FirewallGroups>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<UserAuthentication>0</UserAuthentication>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
<settings pass="oobeSystem">
|
||||||
|
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<AutoLogon>
|
||||||
|
<Password>
|
||||||
|
<Value>MQBBAGQAbQBpAG4AUABhAHMAcwB3AG8AcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
|
||||||
|
<PlainText>false</PlainText>
|
||||||
|
</Password>
|
||||||
|
<Enabled>true</Enabled>
|
||||||
|
<Username>Local-Admin</Username>
|
||||||
|
</AutoLogon>
|
||||||
|
<DesktopOptimization>
|
||||||
|
<ShowWindowsStoreAppsOnTaskbar>false</ShowWindowsStoreAppsOnTaskbar>
|
||||||
|
</DesktopOptimization>
|
||||||
|
<OOBE>
|
||||||
|
<HideEULAPage>true</HideEULAPage>
|
||||||
|
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
|
||||||
|
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
|
||||||
|
<HideLocalAccountScreen>true</HideLocalAccountScreen>
|
||||||
|
<ProtectYourPC>1</ProtectYourPC>
|
||||||
|
<UnattendEnableRetailDemo>true</UnattendEnableRetailDemo>
|
||||||
|
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
|
||||||
|
</OOBE>
|
||||||
|
<UserAccounts>
|
||||||
|
<LocalAccounts>
|
||||||
|
<LocalAccount wcm:action="add">
|
||||||
|
<Password>
|
||||||
|
<Value>MQBBAGQAbQBpAG4AUABhAHMAcwB3AG8AcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
|
||||||
|
<PlainText>false</PlainText>
|
||||||
|
</Password>
|
||||||
|
<DisplayName>Administrator (Local)</DisplayName>
|
||||||
|
<Group>Administrators</Group>
|
||||||
|
<Name>Local-Admin</Name>
|
||||||
|
</LocalAccount>
|
||||||
|
</LocalAccounts>
|
||||||
|
</UserAccounts>
|
||||||
|
<WindowsFeatures>
|
||||||
|
<ShowInternetExplorer>false</ShowInternetExplorer>
|
||||||
|
<ShowMediaCenter>false</ShowMediaCenter>
|
||||||
|
<ShowWindowsMediaPlayer>false</ShowWindowsMediaPlayer>
|
||||||
|
</WindowsFeatures>
|
||||||
|
<BluetoothTaskbarIconEnabled>false</BluetoothTaskbarIconEnabled>
|
||||||
|
<ConvertibleSlateModePromptPreference>0</ConvertibleSlateModePromptPreference>
|
||||||
|
<DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
|
||||||
|
<SignInMode>1</SignInMode>
|
||||||
|
<TimeZone>W. Europe Standard Time</TimeZone>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<InputLocale>de-CH</InputLocale>
|
||||||
|
<SystemLocale>de-CH</SystemLocale>
|
||||||
|
<UILanguage>de-CH</UILanguage>
|
||||||
|
<UILanguageFallback>de-CH</UILanguageFallback>
|
||||||
|
<UserLocale>de-CH</UserLocale>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
<cpi:offlineImage cpi:source="wim:c:/winserver_image/02_sources/2016/wim/install.wim#Windows Server 2016 SERVERDATACENTER" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
|
||||||
|
</unattend>
|
||||||
3
01_Config/SetupComplete.cmd
Normal file
3
01_Config/SetupComplete.cmd
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
PowerShell "Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser -Force"
|
||||||
|
PowerShell ". C:\Windows\Setup\Scripts\BGInfo.ps1"
|
||||||
|
PowerShell ". C:\Windows\Setup\Scripts\Network.ps1"
|
||||||
122
01_Config/unattend.xml
Normal file
122
01_Config/unattend.xml
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||||
|
<servicing>
|
||||||
|
<package action="configure">
|
||||||
|
<assemblyIdentity name="Package_for_KB3192137" version="10.0.1.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="" />
|
||||||
|
</package>
|
||||||
|
<package action="configure">
|
||||||
|
<assemblyIdentity name="Package_for_KB3211320" version="10.0.1.1" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="" />
|
||||||
|
</package>
|
||||||
|
</servicing>
|
||||||
|
<settings pass="windowsPE">
|
||||||
|
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<InputLocale>eu-US</InputLocale>
|
||||||
|
<SystemLocale>eu-US</SystemLocale>
|
||||||
|
<UILanguage>eu-US</UILanguage>
|
||||||
|
<UILanguageFallback>eu-US</UILanguageFallback>
|
||||||
|
<UserLocale>de-CH</UserLocale>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<UserData>
|
||||||
|
<AcceptEula>true</AcceptEula>
|
||||||
|
<FullName>1AdminAccount</FullName>
|
||||||
|
</UserData>
|
||||||
|
<EnableFirewall>true</EnableFirewall>
|
||||||
|
<EnableNetwork>true</EnableNetwork>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
<settings pass="generalize">
|
||||||
|
<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<SkipRearm>1</SkipRearm>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
<settings pass="specialize">
|
||||||
|
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<InputLocale>en-US</InputLocale>
|
||||||
|
<SystemLocale>en-US</SystemLocale>
|
||||||
|
<UILanguage>en-US</UILanguage>
|
||||||
|
<UILanguageFallback>en-US</UILanguageFallback>
|
||||||
|
<UserLocale>de-CH</UserLocale>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<SkipAutoActivation>true</SkipAutoActivation>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-SQMApi" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<CEIPEnabled>0</CEIPEnabled>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<ComputerName>1Name</ComputerName>
|
||||||
|
<ProductKey>1ProductID</ProductKey>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<fDenyTSConnections>false</fDenyTSConnections>
|
||||||
|
</component>
|
||||||
|
<component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<FirewallGroups>
|
||||||
|
<FirewallGroup wcm:action="add" wcm:keyValue="1">
|
||||||
|
<Active>true</Active>
|
||||||
|
<Group>Remote Desktop</Group>
|
||||||
|
<Profile>all</Profile>
|
||||||
|
</FirewallGroup>
|
||||||
|
</FirewallGroups>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<UserAuthentication>0</UserAuthentication>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
<settings pass="oobeSystem">
|
||||||
|
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<AutoLogon>
|
||||||
|
<Password>
|
||||||
|
<Value>MQBBAGQAbQBpAG4AUABhAHMAcwB3AG8AcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
|
||||||
|
<PlainText>false</PlainText>
|
||||||
|
</Password>
|
||||||
|
<Enabled>true</Enabled>
|
||||||
|
<Username>1AdminAccount</Username>
|
||||||
|
</AutoLogon>
|
||||||
|
<DesktopOptimization>
|
||||||
|
<ShowWindowsStoreAppsOnTaskbar>false</ShowWindowsStoreAppsOnTaskbar>
|
||||||
|
</DesktopOptimization>
|
||||||
|
<OOBE>
|
||||||
|
<HideEULAPage>true</HideEULAPage>
|
||||||
|
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
|
||||||
|
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
|
||||||
|
<HideLocalAccountScreen>true</HideLocalAccountScreen>
|
||||||
|
<ProtectYourPC>1</ProtectYourPC>
|
||||||
|
<UnattendEnableRetailDemo>true</UnattendEnableRetailDemo>
|
||||||
|
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
|
||||||
|
</OOBE>
|
||||||
|
<UserAccounts>
|
||||||
|
<LocalAccounts>
|
||||||
|
<LocalAccount wcm:action="add">
|
||||||
|
<Password>
|
||||||
|
<Value>MQBBAGQAbQBpAG4AUABhAHMAcwB3AG8AcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
|
||||||
|
<PlainText>false</PlainText>
|
||||||
|
</Password>
|
||||||
|
<DisplayName>1AdminDisplayName</DisplayName>
|
||||||
|
<Group>Administrators</Group>
|
||||||
|
<Name>1AdminAccount</Name>
|
||||||
|
</LocalAccount>
|
||||||
|
</LocalAccounts>
|
||||||
|
</UserAccounts>
|
||||||
|
<WindowsFeatures>
|
||||||
|
<ShowInternetExplorer>false</ShowInternetExplorer>
|
||||||
|
<ShowMediaCenter>false</ShowMediaCenter>
|
||||||
|
<ShowWindowsMediaPlayer>false</ShowWindowsMediaPlayer>
|
||||||
|
</WindowsFeatures>
|
||||||
|
<BluetoothTaskbarIconEnabled>false</BluetoothTaskbarIconEnabled>
|
||||||
|
<ConvertibleSlateModePromptPreference>0</ConvertibleSlateModePromptPreference>
|
||||||
|
<DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
|
||||||
|
<SignInMode>1</SignInMode>
|
||||||
|
<TimeZone>W. Europe Standard Time</TimeZone>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<InputLocale>de-CH</InputLocale>
|
||||||
|
<SystemLocale>de-CH</SystemLocale>
|
||||||
|
<UILanguage>de-CH</UILanguage>
|
||||||
|
<UILanguageFallback>de-CH</UILanguageFallback>
|
||||||
|
<UserLocale>de-CH</UserLocale>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
<cpi:offlineImage cpi:source="wim:c:/winserver_image/02_sources/2016/wim/install.wim#Windows Server 2016 SERVERDATACENTER" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
|
||||||
|
</unattend>
|
||||||
0
02_Sources/2016/SYSPREP/2016_SypPrep-GUI.vhdx.txt
Normal file
0
02_Sources/2016/SYSPREP/2016_SypPrep-GUI.vhdx.txt
Normal file
0
02_Sources/2016/SYSPREP/2016_SysPrep_CORE.vhdx.txt
Normal file
0
02_Sources/2016/SYSPREP/2016_SysPrep_CORE.vhdx.txt
Normal file
0
02_Sources/2016/WIM/boot.wim.txt
Normal file
0
02_Sources/2016/WIM/boot.wim.txt
Normal file
0
02_Sources/2016/WIM/install.wim.txt
Normal file
0
02_Sources/2016/WIM/install.wim.txt
Normal file
184
Win2016_GUI.ps1
Normal file
184
Win2016_GUI.ps1
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
# -------------------------------------- Part 1 Start -------------------------------------- #
|
||||||
|
|
||||||
|
# Computername & VMName
|
||||||
|
$Name = "SRV-WSUS-01"
|
||||||
|
|
||||||
|
# CPU's
|
||||||
|
$CPUCount = 2
|
||||||
|
|
||||||
|
# VM Generation
|
||||||
|
$Generation = 2
|
||||||
|
|
||||||
|
# RAM
|
||||||
|
$RAMCount = 2GB
|
||||||
|
$RAMCountMin = 1GB
|
||||||
|
$RAMCountMax = 4GB
|
||||||
|
|
||||||
|
# DNS Domain Name
|
||||||
|
$DNSDomain = "schwab.local"
|
||||||
|
|
||||||
|
# IP Address
|
||||||
|
$IPDomain = "192.168.10.15"
|
||||||
|
|
||||||
|
# Default Gateway to be used
|
||||||
|
$DefaultGW = "192.168.10.1"
|
||||||
|
|
||||||
|
# DNS Server
|
||||||
|
$DNSServer1 = "192.168.10.11"
|
||||||
|
$DNSServer2 = "192.168.10.10"
|
||||||
|
|
||||||
|
# Hyper-V Switch Name
|
||||||
|
$SwitchNameDomain = "Private Net"
|
||||||
|
|
||||||
|
#Set the VM Domain access NIC name
|
||||||
|
$NetworkAdapterName = "Primary Adapter"
|
||||||
|
|
||||||
|
# Username & Password
|
||||||
|
$AdminAccount = "Local-Admin"
|
||||||
|
$AdminDisplayName = "Administrator (Local)"
|
||||||
|
$AdminPassword = "ABCD-1234"
|
||||||
|
|
||||||
|
# This ProductID is actually the AVMA key provided by MS
|
||||||
|
$ProductID = "TMJ3Y-NTRTM-FJYXT-T22BY-CWG3J"
|
||||||
|
|
||||||
|
# Where's the VM Default location? You can also specify it manually
|
||||||
|
$Path = Get-VMHost | select VirtualMachinePath -ExpandProperty VirtualMachinePath
|
||||||
|
|
||||||
|
# Where should I store the VM VHD?, you actually have nothing to do here unless you want a custom name on the VHD
|
||||||
|
$VHDPath = $Path + $Name + "\" + "Virtual Disks"
|
||||||
|
$VHDPathFile = $Path + $Name + "\" + "Virtual Disks" + "\" + $Name + ".vhdx"
|
||||||
|
|
||||||
|
# Where are the folders with prereq software ?
|
||||||
|
$StartupFolder = ".\01_Config\$Name"
|
||||||
|
$TemplateLocation = ".\02_Sources\2016\SYSPREP\2016_SypPrep-GUI.vhdx"
|
||||||
|
$UnattendLocation = ".\01_Config"
|
||||||
|
|
||||||
|
# -------------------------------------- Part 1 Stop --------------------------------------- #
|
||||||
|
|
||||||
|
function FN-Unattend
|
||||||
|
{
|
||||||
|
Copy-Item $UnattendLocation\Unattend.xml $StartupFolder\Unattend-$Name.xml
|
||||||
|
|
||||||
|
$DefaultXML = $StartupFolder+"\Unattend-"+$Name+".xml"
|
||||||
|
$NewXML = $StartupFolder+"\Unattend-"+$Name+".xml"
|
||||||
|
$DefaultXML = Get-Content $DefaultXML
|
||||||
|
$DefaultXML | Foreach-Object {
|
||||||
|
$_ -replace '1AdminAccount', $AdminAccount `
|
||||||
|
-replace '1AdminDisplayName', $AdminDisplayName `
|
||||||
|
-replace '1Name', $Name `
|
||||||
|
-replace '1ProductID', $ProductID`
|
||||||
|
-replace '1AdminPassword', $AdminPassword `
|
||||||
|
} | Set-Content $NewXML
|
||||||
|
}
|
||||||
|
|
||||||
|
function FN-Network
|
||||||
|
{
|
||||||
|
Copy-Item $UnattendLocation\Network.ps1 $StartupFolder\Network-$Name.ps1
|
||||||
|
|
||||||
|
$DefaultNetwork = $StartupFolder+ "\Network-"+$Name+".ps1"
|
||||||
|
$NewNetwork = $StartupFolder+ "\Network-"+$Name+".ps1"
|
||||||
|
$DefaultNetwork = Get-Content $DefaultNetwork
|
||||||
|
$DefaultNetwork | Foreach-Object {
|
||||||
|
$_ -replace '1MACAddress', $MACAddress `
|
||||||
|
-replace '1NetworkAdapterName', $NetworkAdapterName `
|
||||||
|
-replace '1IPDomain', $IPDomain `
|
||||||
|
-replace '1DefaultGW', $DefaultGW `
|
||||||
|
-replace '1DNSServer1', $DNSServer1 `
|
||||||
|
-replace '1DNSServer2', $DNSServer2 `
|
||||||
|
-replace '1DNSDomain', $DNSDomain `
|
||||||
|
} | Set-Content $NewNetwork
|
||||||
|
}
|
||||||
|
|
||||||
|
function FN-BGInfo
|
||||||
|
{
|
||||||
|
Copy-Item $UnattendLocation\BGInfo.ps1 $StartupFolder\BGInfo-$Name.ps1
|
||||||
|
|
||||||
|
$NewBGInfo = $StartupFolder+ "\BGInfo-"+$Name+".ps1"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# -------------------------------------- Part 2 Start -------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
|
# -- Check if VM exists -- #
|
||||||
|
|
||||||
|
$VMS = Get-VM
|
||||||
|
Foreach($VM in $VMS)
|
||||||
|
{
|
||||||
|
if ($Name -match $VM.Name)
|
||||||
|
{
|
||||||
|
write-host -ForegroundColor Red "Found VM With the same name!!!!!"
|
||||||
|
$Found=$True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# -- Create the VM -- #
|
||||||
|
|
||||||
|
New-VM -Name $Name -Path $Path -MemoryStartupBytes $RAMCount -Generation 2 -NoVHD
|
||||||
|
|
||||||
|
# -- Remove any auto generated adapters and add new ones with correct names for Consistent Device Naming -- #
|
||||||
|
|
||||||
|
Get-VMNetworkAdapter -VMName $Name | Remove-VMNetworkAdapter
|
||||||
|
Add-VMNetworkAdapter -VMName $Name -SwitchName $SwitchNameDomain -Name $NetworkAdapterName -DeviceNaming On
|
||||||
|
|
||||||
|
# -- Start and stop VM to get mac address, then arm the new MAC address on the NIC itself -- #
|
||||||
|
|
||||||
|
start-vm $Name
|
||||||
|
sleep 5
|
||||||
|
stop-vm $Name -Force
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
$MACAddress = Get-VMNetworkAdapter -VMName $Name -Name $NetworkAdapterName|select MacAddress -ExpandProperty MacAddress
|
||||||
|
$MACAddress = ($MACAddress -replace '(..)','$1-').trim('-')
|
||||||
|
Get-VMNetworkAdapter -VMName $Name -Name $NetworkAdapterName|Set-VMNetworkAdapter -StaticMacAddress $MACAddress
|
||||||
|
|
||||||
|
# -- Copy the template and add the disk on the VM. Also configure CPU and start - stop settings -- #
|
||||||
|
|
||||||
|
mkdir $VHDPath
|
||||||
|
Copy-item $TemplateLocation -Destination $VHDPathFile
|
||||||
|
Set-VM -Name $Name -ProcessorCount $CpuCount -AutomaticCheckpointsEnabled $false -AutomaticStartAction Start -AutomaticStopAction ShutDown -AutomaticStartDelay 5 -MemoryMinimumBytes $RAMCountMin -MemoryMaximumBytes $RAMCountMax
|
||||||
|
Add-VMHardDiskDrive -VMName $Name -ControllerType SCSI -Path $VHDPathFile
|
||||||
|
|
||||||
|
# -- Set first boot device to the disk we attached -- #
|
||||||
|
|
||||||
|
$Drive = Get-VMHardDiskDrive -VMName $Name | where {$_.Path -eq "$VHDPathFile"}
|
||||||
|
Get-VMFirmware -VMName $Name | Set-VMFirmware -FirstBootDevice $Drive
|
||||||
|
|
||||||
|
# -- Prepare the unattend.xml & SetupComplete.cmd file to send out, simply copy to a new file and replace values -- #
|
||||||
|
|
||||||
|
mkdir $StartupFolder
|
||||||
|
|
||||||
|
FN-Unattend
|
||||||
|
|
||||||
|
FN-Network
|
||||||
|
|
||||||
|
FN-BGInfo
|
||||||
|
|
||||||
|
|
||||||
|
# -- Mount the new virtual machine VHD -- #
|
||||||
|
|
||||||
|
Mount-VHD -Path $VHDPathFile
|
||||||
|
|
||||||
|
# -- Find the drive letter of the mounted VHD -- #
|
||||||
|
|
||||||
|
$VolumeDriveLetter = GET-DISKIMAGE $VHDPathFile | GET-DISK | GET-PARTITION |get-volume |?{$_.FileSystemLabel -ne "Recovery"}|select DriveLetter -ExpandProperty DriveLetter
|
||||||
|
|
||||||
|
# -- Construct the drive letter of the mounted VHD Drive -- #
|
||||||
|
|
||||||
|
$DriveLetter = "$VolumeDriveLetter"+":"
|
||||||
|
|
||||||
|
# -- Copy the unattend.xml to the drive -- #
|
||||||
|
|
||||||
|
Copy-Item $NewXML $DriveLetter\unattend.xml
|
||||||
|
Copy-Item $NewNetwork $DriveLetter\Windows\Setup\Scripts\Network.ps1
|
||||||
|
Copy-Item $NewBGInfo $DriveLetter\Windows\Setup\Scripts\BGInfo.ps1
|
||||||
|
|
||||||
|
# -- Dismount the VHD -- #
|
||||||
|
|
||||||
|
Dismount-Vhd -Path $VHDPathFile
|
||||||
|
|
||||||
|
# -- Fire up the VM -- #
|
||||||
|
|
||||||
|
Start-VM $Name
|
||||||
|
|
||||||
|
# -------------------------------------- Part 2 Stop --------------------------------------- #
|
||||||
Reference in New Issue
Block a user