Script to show my computer name and IP address

0

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.


RESULT

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

0

Leave a Reply

Close Menu