Immediately we’re going to discuss concerning the HydrationKit maintained by Johan Arwidmark
@jarwidmark which lets you arrange an entire trendy deployment surroundings for working methods.
To start out I created two WPF
purposes with MahApps and PowerShell after all. They mean you can modify the entire surroundings of the hydrationKit.
You’ll be able to modify the next parameters:
- Computer systems Title
- Community addresses
- Area Title
- DHCP configuration
- Passwords
To make use of these two purposes you need to wait a bit of extra as a result of Johan 😉 has not but launched the model based mostly on Home windows Server 2022. Just because all MDT purposes should be complement variables.
1.1 The way it work’s
This utility makes use of the Home windows 11 model. It should retrieve the listing created by Johan’s script on the creation of a HydrationKit tree.
The information for every process sequence is saved within the listing ..ISOContentDeployControl
Every TS has its personal CustomSettings_XXX file the place XXX is the title of the TS
for instance the worth for the DC01
[Settings]
Precedence=Default
Properties=HydrationOSDComputerName
[Default]
HydrationOSDComputerName=DC01
JoinWorkgroup=WORKGROUP
OSDAdapterCount=1
OSDAdapter0DNSServerList=127.0.0.1
OSDAdapter0Gateways=192.168.1.1
OSDAdapter0IPAddressList=192.168.1.200
OSDAdapter0SubnetMask=255.255.255.0
OSDAdapter0TCPIPNetBiosOptions=1
; Energetic Listing Configuration
ReplicaOrNewDomain=Domai
NewDomain=Forest
NewDomainDNSName=corp.viamonstra.com
DomainNetBiosName=VIAMONSTRA
ForestLevel=4
DomainLevel=4
AutoConfigDNS=Sure
ConfirmGC=Sure
CriticalReplicationOnly=No
;DatabasePath=D:NTDS
;ADDSLogPath=D:NTDS
;SysVolPath=D:SYSVOL
SafeModeAdminPassword=P@ssw0rd
SiteName=NewYork
; DHCP Configuration
DHCPServerOptionRouter=192.168.1.1
DHCPServerOptionDNSServer=192.168.1.200
DHCPServerOptionDNSDomainName=corp.viamonstra.com
DHCPScopes0SubnetMask=255.255.255.0
DHCPScopes0IP=192.168.1.0
DHCPScopes0Name=192.168.1.0/24
DHCPScopes0StartIP=192.168.1.100
DHCPScopes0EndIP=192.168.1.199
DHCPScopes0OptionLease=691200
DHCPScopes=1
The WPF Software parse simply this information :
- CustomSettings.ini
- CustomSettings_CM01.ini
- CustomSettings_DC01.ini
- CustomSettings_MDT01.ini
- CustomSettings_FS01.ini
- CustomSettings_DP01.ini
Right here my PowerShell features to parse and create an ini file
Perform Parse-IniFile ($file) {
$ini = @{}
# Create a default part if none exist within the file. Like a java prop file.
$part = "NO_SECTION"
$ini[$section] = @{}
change -regex -file $file {
"^[(.+)]$" {
$part = $matches[1].Trim()
$ini[$section] = @{}
}
"^s*([^#].+?)s*=s*(.*)" {
$title,$worth = $matches[1..2]
# skip feedback that begin with semicolon:
if (!($title.StartsWith(";"))) {
$ini[$section][$name] = $worth.Trim()
}
}
}
$ini
}
perform Out-IniFile($InputObject, $FilePath)
{
$outFile = New-Merchandise -ItemType file -Path $Filepath
foreach ($i in $InputObject.keys)
{
if (!($($InputObject[$i].GetType().Title) -eq "Hashtable"))
{
#No Sections
Add-Content material -Path $outFile -Worth "$i=$($InputObject[$i])"
} else {
#Sections
Add-Content material -Path $outFile -Worth "[$i]"
Foreach ($j in ($InputObject[$i].keys | Kind-Object))
{
if ($j -match "^Remark[d]+") {
Add-Content material -Path $outFile -Worth "$($InputObject[$i][$j])"
} else {
Add-Content material -Path $outFile -Worth "$j=$($InputObject[$i][$j])"
}
}
Add-Content material -Path $outFile -Worth "" -Pressure
}
}
}
While you make a change the ini file is modified accordingly after which you’ve the likelihood to go to the subsequent TS.
Don’t neglect to replace your media when you’ve made change with the instruments.
While you make a change a backup is created in the identical listing with the software you may restore all modifications.
1.2 use it
Nothing beats a bit of demonstration.
My first utility is on the market on Github right here
2.1 the way it work’s
The second utility is completely totally different since it’s an MDT utility
, so when it’s launched it should entry all of the variables created by MDT and modify them on the fly, then save them within the VARAIBLES.DAT file.
Through the process sequence to entry the variables you simply must execute these powershell instructions:
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
# to discover a worth for the variable HydrationOSDComputerName within the File CustomSettings_DC01 for instance
$tsenv.Worth("HydrationOSDComputerName")
2.2 find out how to add this utility
This WPF Software should be copy within the Scripts folder in you DeploymentShare
I forgot within the display seize to say the PowerShell script Run_CWH.ps1 to repeat into the Scripts folder.
2.3 find out how to use it
Right here is find out how to add the script in MDT however particularly at which place in every TS.
2.4 Small demo
My first utility is on the market on Github right here
Thank’s for studying.🤗
Written by Jérôme Bezet-Torres @JM2K69.