Showing posts from November, 2015

PowerShell list printers of remote computers

How to print installed printers on remote computers?

With and PowerShell WMIC it can be don easily.

PowerShell command to list installed printers of a remote PC.

Invoke-command -ComputerName PC0100 -ScriptBlock { wmic printer get name}

Command above needs appropriate privileges to execute successfully and remote computers should be configured to accept remote WMIcommands.

Sample output:

Set IP Address using Netsh and PowerShell

How to set IP Address of the remote computer using PowerShell?
How to set DNS IP Address of the remote computer using PowerShell?
How to set static IP and DNS address in local or remote computer via PowerShell?

Script below will set local IP or set remote IP Address using PowerShell with the help of Netsh command.

For the script to work Winrm or Windows Remote Management must be enabled either on the local PC or remote computer or server.
The script of course needs to run at an elevated mode with the proper rights or privileges or in simple words the script will work only if you have the administrator rights.

Here’s the script:
$set_IP= { netshinterfaceipsetaddress"Wi-Fi"static192.168.1.107255.255.255.0192.168.1.254}
$set_DNS1= {netshinterfaceipadddns"Wi-Fi" }
$SET_DNS2= { netshinterfaceipadddns"Wi-Fi"  }
$show_ipconfig= { ipconfig/all }

Invoke-Command-ScriptBlock$set_IP-ComputerName. Invoke-Command-ScriptBl…

Sign out or set Windows 10 to sleep mode

How to sign out from Windows 10?
How to set Windows 10 to sleep mode?
Just right click on Windows 10 logo, select shutdown or sign out.
Then click in sign out or sleep or select other options provided.

To do it via command line check out this link:

See screen shot below:

PowerShell get network adapter Speed

How to check network adapter speed installed on a computer using PowerShell?
Code snippet below will get the name of all the network adapter installed on a computer and also the speed.
To use the script on a remote computer supply the computer name and run the script with appropriate privileges to get the data on the remote computer.
$computer_name="." $Net_adapter=gwmi-classWin32_NetworkAdapter-namespace"root\CIMV2" ` -computername$computer_name

foreach ($objItemin$Net_adapter) {
"Adapter is: "+$ +" -- "+"Adapter Speed is: "+[math]::truncate($objItem.speed/1MB) +" MB"
Change the 1MB to 1GB if you need the output in GB.

Sample Output:
Adapter is: Teredo Tunneling Pseudo-Interface -- Adapter Speed is: 0 MB Adapter is: Microsoft ISATAP Adapter #3 -- Adapter Speed is: 0 MB Adapter is: VMware Virtual Ethernet Adapter for VMnet1 -- Adapter Speed is: 95 MB Adapter is:…

Ping whole subnet via command line

How to ping the whole subnet using a batch file? script Or command line?
If you just inherited a network or just embark on a new job and no proper documentation is on the table, then pinging the whole subnet is a good start to know the network.

How to shut down the PC if it responds to ping request?
Batch file script below pings the whole subnet and logs the status whether the IP Address is online or offline.
This can be set on the task scheduler and run at interval hours if needed.
FOR /L %I IN (1,0,254) DO   ping 192.168.1.%I -n 2 | for /f "delims=" %a in ('find /C "TTL"') do @set foobar=%a |  IF %a==2 ( echo "192.168.1.%I is online" >>d:\pingx.txt) else ( echo "192.168.1.%I is offine" >>d:\pingx.txt)
Sample output:                " is offine"   " is offine"   " is online"    "192…

Ping range of IP Address via command line

PowerShell check video driver

Get the details of the video card such as driver, version and the video card name.
A simple script to get the details of the video card, script will get the driver and version to check whether a new driver needs to be installed or updated.
To check remote computers, replace the dot with the name of the remote computer to be checked.
Here’s the script:
"Video Name : "+$video_details.Name
"Video Description : "+$video_details.Description
"Video Driver Date : "+$video_details.DriverDate
"Video Version : "+$video_details.DriverVersion
"Video Processor :"+$video_details.VideoProcessor
"Video Drivers : "+$video_details.InstalledDisplayDrivers
Sample output:
Video Name : Intel(R) HD Graphics Video Description : Intel(R) HD Graphics Video Driver Date : 20121126000000.000000-000 Vide…

PowerShell get installed software on remote computers

How to get or list installed softwares on remote computers?
Check installed programs or softwares on remote computers using PowerShell.

PowerShell can do the task easily to get software installed on remote computer provided the script is run with proper privileges

Here’s the script below on how to list of installed software on remote PCs.
$get_progs=gwmi-classWin32_product-computername$computer_name|where-object {$ -match"^Roxio" }
#$$get_progs=gwmi  -class Win32_product | where-object {$_.vendor -match "^Roxio" }
Sample output:               IdentifyingNumber : {1F54DAFA-9261-4A62-B59D-6C9F26B48FE4} Name              : Roxio Creator Tools Vendor            : Roxio Version           : 3.8.0 Caption           : Roxio Creator Tools
IdentifyingNumber : {08E81ABD-79F7-49C2-881F-FD6CB0975693} Name              : Roxio Creator D…

PowerShell check wallpaper location

How to check or save wallpaper?
Check remote computer wallpaper location.

PowerShell code snippet to check wallpaper:



Sample output:
Code snippet works fine in Windows 10.