Script to show my computer name and IP address

If you need to know the name of the computer of a user or the IP address, then this tiny PowerShell script can become handy. For example, that information might be required for remote assistance software.

There are some tools out there that show this info, e.g. BgInfo, but they don’t always work. Moreover, some users insist on seeing an unobstructed photo of their puppy they just got from a shelter. That’s a big one!

1) Create a PowerShell script file with this content:

Add-Type -AssemblyName System.Windows.Forms
$ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1} 
$ipaddress = $ip.ipaddress[0]
$pcname = [System.Net.Dns]::GetHostName()
[System.Windows.Forms.MessageBox]::Show("My PC name - $pcname `n`nMy IP address - $ipaddress",'About my PC','OK','Information')

This script is a modified combination of scripts out there that other people made, so by no means I’m trying to take any credits for it.

2) Put this script to a network location that every user has Read access to.

3) Create a Shortcut that runs PowerShell and points to that location:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File "\\networklocation\software$\info.ps1"

4) Optionally change its icon.

5) Distribute that Shortcut to all users’ computers through a policy.


When users open that Shortcut, a window will pop up, then they can pass all that info to you as an admin:

This Post Has 6 Comments

  1. Rob

    Just what I needed . Thank you very much.

    1. Pavel Bludov

      Awesome, Rob!

  2. Rob

    Hi Pavel, How can the script show all IP addresses? Say you have a PC with a WiFi connection & an Ethernet connection and then connecting in via VPN?

    1. Pavel Bludov

      Replace this:
      $ipaddress = $ip.ipaddress[0]
      With this:
      $ipaddress = $ip.ipaddress -join “; “
      Not the best looking and you might want to do more filtering and digging but that’s how you show them all.

  3. sapiro

    hey Pavel
    how can i add my company logo to the script ?
    and how to make bold text /

    tnx 🙂

    1. Pavel Bludov

      Hi Sapiro,
      As far as I know there is no way to perform either of the tasks you mentioned.

Leave a Reply