Update the Windows install.

This commit is contained in:
markjcrane
2018-01-03 01:13:29 -07:00
parent 4829f22abf
commit 74abcb8196
26 changed files with 655 additions and 484 deletions

View File

@@ -0,0 +1,15 @@
#Set the domain name
$cert = Get-ChildItem -Path cert:\LocalMachine\My | Where-Object -Property Subject -Like "CN=${env:COMPUTERNAME}*" | Sort-Object NotAfter | Select-Object -Last 1
if ( $cert -and ($domain_name -eq "hostname") ) {
$domain_name = $cert.Subject.Substring(3)
}
elseif ($domain_name -eq "hostname") {
$domain_name = $env:COMPUTERNAME
#$dns = [System.Net.Dns]::GetHostByName(($env:computerName))
#$domain_name = $dns.HostName
#$dns.addresslist.IPAddressToString
}
else {
$domain_name = [System.Net.Dns]::GetHostByName(($env:computerName)).AddressList.IPAddressToString
}
Write-Host "Domain Name is $domain_name"