forked from norman/fusionpbx-install.sh-github-mirror
Update the Windows install.
This commit is contained in:
15
windows/resources/domain_name.ps1
Normal file
15
windows/resources/domain_name.ps1
Normal 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"
|
||||
Reference in New Issue
Block a user