SCCM 2012: Add FQDN of host as TS variable

Standard

Yesterday I created a small powershell script which adds the FQDN of a host as a Task Sequence variable to a SCCM task sequence. See below the script:

$regkey   = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
$hostname = $regkey.Hostname
$domain   = $regkey.domain

if($domain -eq "") {
    $HostFQDN = $hostname
} else {
    $HostFQDN = $hostname+"."+ $domain
}

$TaskSeq_var = New-Object -COMObject Microsoft.SMS.TSEnvironment
$TaskSeq_var.value("HostFQDN") = $HostFQDN

 

One thought on “SCCM 2012: Add FQDN of host as TS variable

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.