/build/static/layout/Breadcrumb_cap_w.png

Script to know Machine ID/IP,Location,Printer Information,WIFI signal info

Kindly help me on this ASAP.


0 Comments   [ + ] Show comments

Answers (4)

Answer Summary:
$comp = $env:computername $file = "c:\temp\test.txt" $printer= get-wmiobject win32_printer|format-list name|out-string $ip= get-wmiobject -query "Select IPAddress From Win32_NetworkAdapterConfiguration Where IPEnabled = True"| format-list IPaddress|out-string $wireless = NETSH WLAN SHOW INTERFACE $var=("Computer Name: $comp" + " Printers: $printer" + "IP: $ip" + "Wireless Info: $wireless") | out-file $file
Posted by: dugullett 12 years ago
Red Belt
2

Just curious....

How would a machine know it's location?

By WIFI signal info do you mean SSID?

I'm assuming since you are looking for wireless you want the wireless IP not the wired?

What format of script are you looking for?

 

This will get you started in Powershell.

$comp = $env:computername
$file = "c:\temp\test.txt"
$printer= get-wmiobject win32_printer|format-list name|out-string
$ip= get-wmiobject -query "Select IPAddress From Win32_NetworkAdapterConfiguration Where IPEnabled = True"| format-list IPaddress|out-string
$var=("Computer Name: $comp"  +
    "
    
Printers: $printer" + "IP: $ip") | out-file $file
 
NETSH WLAN SHOW INTERFACE should work for the SSID and signal strength, but since my laptop is at home I cannot test that. This would include this info (not tested).
 
$comp = $env:computername
$file = "c:\temp\test.txt"
$printer= get-wmiobject win32_printer|format-list name|out-string
$ip= get-wmiobject -query "Select IPAddress From Win32_NetworkAdapterConfiguration Where IPEnabled = True"| format-list IPaddress|out-string
$wireless = NETSH WLAN SHOW INTERFACE
$var=("Computer Name: $comp"  +
    "
    
Printers: $printer" + "IP: $ip" + "Wireless Info:
 
$wireless") | out-file $file

Comments:
  • i wrote 2 VB scripts that will show installed printer and check system info - brighstarcuit 12 years ago
Posted by: brighstarcuit 12 years ago
7th Degree Black Belt
0


' Display error number and description if applicable
If Err Then ShowError

' Query installed printers' properties
Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)

' Display error number and description if applicable
If Err Then ShowError

' Format output for display
For Each objItem in colItems
 strMsg = strMsg & vbCrLf _
        & "Printer Name :  " & objItem.Name & vbCrLf _
        & "Port Name    :  " & objItem.PortName & vbCrLf _
        & "Driver Name  :  " & objItem.DriverName & vbCrLf _
        & "Server Name  :  " & objItem.ServerName & vbCrLf _
        & "Share Name   :  " & objItem.ShareName & vbCrLf
Next

' Display the results
WScript.Echo strMsg

'Done
WScript.Quit(0)


Sub ShowError()
 strMsg = vbCrLf & "Error # " & Err.Number & vbCrLf & _
          Err.Description & vbCrLf & vbCrLf
 Syntax
End Sub


Sub Syntax()
 strMsg = strMsg & vbCrLf _
        & "ShowPRN.vbs,  Version 1.00" & vbCrLf _
        & "Display installed printers properties for " _
        & "any computer on the network" & vbCrLf & vbCrLf _
        & "Usage:  CSCRIPT  //NOLOGO  SHOWPRN.VBS  " _
        & "[ computer_name ]" & vbCrLf & vbCrLf _
        & "Where:  " & Chr(34) & "computer_name" & Chr(34) _
        & " is the optional name of a remote" & vbCrLf _
        & "        computer (default is local computer " _
        & "name)" & vbCrLf & vbCrLf _
        & "Written by Rob van der Woude" & vbCrLf _
        & "http://www.robvanderwoude.com" & vbCrLf & vbCrLf _
        & "Created with Microsoft's Scriptomatic tool" & vbCrLf _
        & "http://www.microsoft.com/technet/treeview/default.asp" _
        & "?url=/technet/scriptcenter/WMImatic.asp" & vbCrLf
 WScript.Echo strMsg
 WScript.Quit(1)
End Sub


Comments:
Posted by: brighstarcuit 12 years ago
7th Degree Black Belt
0

@echo off

ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto ver_2003

ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp

ver | find "2000" > nul
if %ERRORLEVEL% == 0 goto ver_2000

ver | find "NT" > nul
if %ERRORLEVEL% == 0 goto ver_nt

if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexit

systeminfo | find "OS Name" > %TEMP%\osname.txt
FOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%i

echo %vers% | find "Windows 7" > nul
if %ERRORLEVEL% == 0 goto ver_7

echo %vers% | find "Windows Server 2008" > nul
if %ERRORLEVEL% == 0 goto ver_2008

echo %vers% | find "Windows Vista" > nul
if %ERRORLEVEL% == 0 goto ver_vista

goto warnthenexit

:ver_7
:Run Windows 7 specific commands here.
echo Windows 7
goto exit

:ver_2008
:Run Windows Server 2008 specific commands here.
echo Windows Server 2008
goto exit

:ver_vista
:Run Windows Vista specific commands here.
echo Windows Vista
goto exit

:ver_2003
:Run Windows Server 2003 specific commands here.
echo Windows Server 2003
goto exit

:ver_xp
:Run Windows XP specific commands here.
echo Windows XP
goto exit

:ver_2000
:Run Windows 2000 specific commands here.
echo Windows 2000
goto exit

:ver_nt
:Run Windows NT specific commands here.
echo Windows NT
goto exit

:warnthenexit
echo Machine undetermined.

:exit


Comments:
  • This would just get the OS. That wasn't one he was looking for. - dugullett 12 years ago
Posted by: SMal.tmcc 12 years ago
Red Belt
0

You will most likely need a 3rd party tool if you want any details about the wifi around a computer

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ