Orchestrator: Get FQDN activity

Sometimes you need to get the FQDN of a computer within a runbook for the following activity (example: SCOM – Start Maintenance Mode). Most activities provide only the Netbios name (example: Get Computer IP/Status).

I have a simple Run Program activity that utilizes PowerShell to get that information.

getfqdn

getfqdn-details

It runs on the computer for which you would like to get the FQDN.

Command:
cmd.exe /c | c:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe –c “[System.Net.Dns]::GetHostEntry(‘%Netbios computername from previous activity%‘).hostname”

In the following activity you only need to use the Pure Output from “Get FQDN”, which is now the FQDN of the computer.

You can also use the Run .Net  Script activity, that runs on the Runbook server. getfqdn 

Then you only need to select PowerShell as the script language and enter $FQDN=[System.Net.Dns]::GetHostEntry(‘%Netbios computername from previous activity%‘).hostname as script. Publish the variable FQDN in Published Data and you can use this variable in the next activity.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Comments

  • Tony  On April 7, 2014 at 9:28 pm

    Hello, I tried using your example but ran into problems. My Run Program is retuning the following and nothing else:

    [System.Net.Dns]::GetHostEntry(‘computer_name’).hostname

    It is the actual PowerShell Synatax, when I manually run the syntax manual in PowerShell I get the computer name along with the FQDN. Any suggestions regarding what I may be doing incorrectly?

    –Tony

    • opsmgrtipps  On July 31, 2014 at 9:11 am

      Tony,

      try it with the Run .Net Script activity, which runs on the Runbook server.

      Regards,

      Natascia

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: