Wednesday, August 17, 2016

Share printer with commnad on own or remote pc

We can use pstools to connect to remote pc command prompt,, download it from

https://download.sysinternals.com/files/PSTools.zip

extract pstools folder --> hold the shift key --> right click in the folder --> select command prompt
Start a CMD session on the remote machine using psexec by typing below commnad

psexec \\remote-pc cmd

After connecting, list the printers available on the machine:
c:\pstools\>wmic printer get name
printer1

  1. If you want to make printer1above shared:
    > rundll32 printui.dll,PrintUIEntry /Xs /n "printer1" Sharename "Printer1"
    > rundll32 printui.dll,PrintUIEntry /q /Xs /n "printer1" Attributes Shared
  2. Confirm the printer is available by going to \\remote-machine in Windows Explorer; you should see the printer available now.
To get printer shared or not or to know the sharename of the printer with command type the following : 

wmic /node:remote-pc printer get shared,sharename,caption,name,portname

To delete printer 
wmic printer where name='printer1' delete
wmic printer where local='false' delete

To list printer in brief

wmic printer list brief

wmic /node:steve-pc service list brief
wmic process where name="notepad.exe" call setpriority 64



Examples
WMIC OS 

WMIC OS LIST BRIEF

WMIC OS GET csname, locale, bootdevice

WMIC OS GET osarchitecture /value

WMIC OS GET localdatetime

WMIC LOGICALDISK where drivetype!=4 get deviceid, description

WMIC LOGICALDISK where description='Local Fixed Disk' get deviceid, volumename

WMIC NTEVENT where LogFile='system'

WMIC NTEVENT where "LogFile='system' and Type>'0'" 

WMIC SERVICE where (state=”running”) GET caption, name, state > services.tsv

WMIC SERVICE where caption='TELNET' CALL STARTSERVICE

WMIC PRINTER LIST STATUS

WMIC PRINTER where PortName="LPT1:" GET PortName, Name, ShareName
 
WMIC /INTERACTIVE:ON PRINTER where PortName="LPT1:" DELETE

WMIC PROCESS where name='evil.exe' delete

WMIC /output:"%computername%.txt" MEMORYCHIP where "memorytype=17" get Capacity

WMIC /node:remote_computer PROCESS call create "netstat.exe -ano > C:\output.txt"

WMIC /node:@workstns.txt /failfast:on PROCESS call create "\\server\share\installer.cmd"

Interactive mode:
C:> WMIC
wmic:root\cli> OS get csname
wmic:root\cli> quit



We can use pstools to connect to remote pc command prompt,, download it from

https://download.sysinternals.com/files/PSTools.zip

extract pstools folder --> hold the shift key --> right click in the folder --> select command prompt
Start a CMD session on the remote machine using psexec by typing below commnad

psexec \\remote-pc cmd

After connecting, list the printers available on the machine:
c:\pstools\>wmic printer get name
printer1

  1. If you want to make printer1above shared:
    > rundll32 printui.dll,PrintUIEntry /Xs /n "printer1" Sharename "Printer1"
    > rundll32 printui.dll,PrintUIEntry /q /Xs /n "printer1" Attributes Shared
  2. Confirm the printer is available by going to \\remote-machine in Windows Explorer; you should see the printer available now.
To get printer shared or not or to know the sharename of the printer with command type the following : 

wmic /node:remote-pc printer get shared,sharename,caption,name,portname


To delete printer according to crieteria 

wmic printer where name='printer1' delete
wmic printer where local='false' delete

Examples
WMIC OS 

WMIC OS LIST BRIEF

WMIC OS GET csname, locale, bootdevice

WMIC OS GET osarchitecture /value

WMIC OS GET localdatetime

WMIC LOGICALDISK where drivetype!=4 get deviceid, description

WMIC LOGICALDISK where description='Local Fixed Disk' get deviceid, volumename

WMIC NTEVENT where LogFile='system'

WMIC NTEVENT where "LogFile='system' and Type>'0'" 

WMIC SERVICE where (state=”running”) GET caption, name, state > services.tsv

WMIC SERVICE where caption='TELNET' CALL STARTSERVICE

WMIC PRINTER LIST STATUS

WMIC PRINTER where PortName="LPT1:" GET PortName, Name, ShareName
 
WMIC /INTERACTIVE:ON PRINTER where PortName="LPT1:" DELETE

WMIC PROCESS where name='evil.exe' delete

WMIC /output:"%computername%.txt" MEMORYCHIP where "memorytype=17" get Capacity

WMIC /node:remote_computer PROCESS call create "netstat.exe -ano > C:\output.txt"

WMIC /node:@workstns.txt /failfast:on PROCESS call create "\\server\share\installer.cmd"

Interactive mode:
C:> WMIC
wmic:root\cli> OS get csname
wmic:root\cli> quit


Monday, August 15, 2016

Computer Management open for remote system

Open run or cmd window and type the following
mmc c:\windows\system32\compmgmt.msc /computer:\\ComputerName

The aim for this Wiki is to promote using a command to open up commonly used applications without having to go through many mouse clicks - thus saving time on monitoring and troubleshooting Windows machines.
Answer entries need to specify
  • Application name
  • Commands
  • Screenshot (Optional)
Shortcut to commands

Restore point creation with command prompt

his method shows you how to open System Restore using Command Prompt
Please perform the following steps:
In the Command Prompt or in run windows type

systempropertiesprotection
Please press Enter to execute

OR

In the Command Prompt type the below command

wmic.exe /Namespace:\\root\default Path SystemRestore Call CreateRestorePoint "My Shortcut Restore Point", 100, 7

TIP : to view system icons if unable to see any icon in change icon settings then go to following path
C:\Windows\System32\imageres.dll
ok

System Restore is implemented using the Volume Shadow Copy Service (Volume Snapshot Service, VSS). As such, you can use vssadmin in an elevated command prompt to list all of the restore points:
vssadmin List Shadows
Note that Windows Backup also uses VSS, with shadow copies stored on both the system and backup drives, so if your backup drive is connected, the shadow copies stored on the backup drive corresponding to these backups will be listed as well. Add /for=C: to specify the volume you want to list the shadow copies for, replacing C: with the volume letter of your choice if it is not C:.
While this isn't the easiest way to work with restore points, you can use the creation date and time and shadow copy ID listed in the output from the above command to delete specific restore points, using the vssadmin Delete Shadows command. You can also create restore points with vssadmin Create Shadow and change the amount of space available to restore points with vssadmin Resize ShadowStorage.
  • vssadmin list shadowstorage - This command lists all connected hard drives and their used, allocated and maximum shadow copy storage space.
  • vssadmin list shadows - This command lists all existing shadow copies on the system
  • vssadmin delete shadows /for=c: /oldest - This command deletes the oldest shadow copy on drive C
  • vssadmin delete shadows /for=d: /all - This command deletes all existing shadow copies on drive D
  • vssadmin delete shadows /for=c: /shadow=ID - Deletes the selected shadow copy. The IDs are listed when you use the list shadows command.
  • vssadmin resize shadowstorage /for=c: /maxsize=2GB - Sets the shadow storage for drive C to 2 Gigabyte. May delete existing restore points starting with the oldest if space is not sufficient to store all System Restore points
Run Powershell as an administrator. At the prompt:
Get-ComputerRestorePoint
This will list all the system restore points.
Powershell offers 4 Cmdlets to manage system restore and/or restore points:
  1. Disable-ComputerRestore
  2. Enable-ComputerRestore
  3. Get-ComputerRestorePoint
  4. Restore-Computer
For assistance with any of them, you can add get-help in front of the Cmdlet, i.e.
get-help Get-ComputerRestorePoint

Tuesday, August 9, 2016

How to install software with command prompt

Connect to internet
open command prompt with admin privileged and run below command as it is...

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

To install software

choco install chrome


choco install winrar


choco search java

choco update <package name>

To uninstall software with command

wmic product get name

wmic product where name="product name" call uninstall /nointeractive

or

for msi package

msiexec /q /x <product name>

msiexec /uninstall Application.msi /quiet

happy downloading brows


Sunday, July 3, 2016

How To Find Wi-Fi Password Using CMD Of All Connected Networks

Whenever we connect to a WiFi network and enter the password to connect to that network, we actually make a WLAN profile of that WiFi network. That profile is stored inside our computer along with the other required details of the WiFi profile.

These steps work even when you are totally offline or you are not connected to the particular wifi you are looking the password for.

How to know the WiFi password using cmd:

  • Open the command prompt and run it as administrator.
netsh wlan show profile
This command will list out all the WiFi profiles that you have ever connected to.

So, let’s go and find out the password for the WiFi 
  • Type the following command to see the password of any WiFi network:
netsh wlan show profile WiFi-name key=clear
  • Under the security settings, in the ‘key content’, you see the WiFi password of that particular network.
Besides knowing the password, you can also use this result to further optimize your WiFi. For example, Under the profile information, you can see mac randomization is disabled. You can turn on mac randomization feature to avoid your location tracking based on the device’s MAC address.

Here is how to turn on mac randomization on Windows 10:

  • Go to settings and click on ‘Network & internet’
  • Choose the ‘WiFi’ in the left pane and click on the advanced option.
  • Turn on the ‘Random Hardware Address’ feature under this settings. If your wireless hardware does not support this feature, the “Random Hardware Addresses” section will not show up at all in the settings app.
  • Once you have turned this on, you are done.
Also, under the connectivity settings, in radio type, you can see the whole list. Channel interference could be another reason for a slow WiFi. So, next time, you might also like to change the radio type settings for a better speed.
As far as radio type is concerned, you can also change that in your router for a better connection or connectivity. For this purpose, we have a dedicated article on to increase WiFi speed by choosing correct WiFi channel.
If you are also aware of some more tricks and tweaks like this, please put them in the comment below. We would be happy to feature some of those in our next articles.