Thursday, May 25, 2017

[Windows]: Add, remove, edit, backup, restore Stored User Names and Passwords in Windows 10

Add, remove, edit, backup, restore Stored User Names and Passwords in Windows 10



Solution 1


The Stored User Names and Passwords in Windows lets you securely manage user names and passwords as a part of your profile. It lets you automatically enter saved user names and passwords for various network resources, servers, websites and applications, to authenticate yourself. In this post we will see how to add, remove, edit, backup, restore Stored User Names and Passwords & Credentials in Windows 10/8/7.

Stored User Names and Passwords

To directly access the Stored User Names and Passwords Control panel applet, via WinX menu, open Command Prompt (Admin), type the following rundll32 command and hit Enter.
rundll32.exe keymgr.dll,KRShowKeyMgr
The Stored User Names and Passwords box will open.
Stored User Names and Passwords
Here you will be able to see the saved passwords and user names.
To add a new credential, press the Add button and fill in the required details as follows:
add Stored User Names and Passwords
To delete a saved password, select the credential and click on the Remove button.
remove Stored User Names and Passwords
To edit a password, click the Edit button. Here you will be edit the details.
edit Stored User Names and Passwords
It could be a Windows logon credential or a Website or Program password.
It is always a good idea to back up the stored user names and passwords. To do this, click on the Back up button to open the following wizard.
back up Stored User Names and Passwords
Select and browse to the back up location, click Next and follow the wizard to its completion.
Should the need arise, you can always restore the backup, by clicking on the Restore button and browsing to the backup file location and selecting it.
restore Stored User Names and Passwords
That’s it!



Solution 2
 

Delete Login Credentials for a Network Share

Remove the cached username and password for a network share(s).
If your network has shares configured with varying read/write permissions, you might it necessary to login to shares with different usernames and passwords. Windows doesn’t make it easy to do this. However, you can delete the login credentials for shares you access, thus making Windows prompt you to login again. Then you can use a different username and password.
First, you should check the Stored User Names and Passwords or Credential Manger. Open the Run dialog or a Command Prompt, enter the following command, and then remove the computer or server if listed:
control keymgr.dll
You should also open a Command Prompt and use the following command:
net use \\fileservername /del
Be sure you replace fileservername with the actual computer or server name you’re trying to access. You can alternatively delete the credentials for all shares:
net use * /del

Wednesday, May 3, 2017

[WINDOWS] : Useful commands for Windows administrators

Useful commands for Windows administrators

Managing a Windows 2000 Active Directory with about 100 servers, over 1500 computers and 35 sites, the following commands often helped me answer questions or solve problems.
Most commands are "one-liners", but for some I had to make an exception and go to the right directory first.

These commands could all be used in batch files, though some may need some "parsing" with FOR /F to retrieve only the required substrings from the displayed information.


Notes:
(1)
Commands that use external, or third party, or non-native utilities contain hyperlinks to these utilities' download sites.
(2)
Replace command arguments displayed in italics with your own values.
(3)
Commands or utilities that require Windows Server 2003 are marked bright blue.
Warning:
Most commands on this page are very powerful tools.
Like most powerful tools they could cause a lot of damage in the hands of insufficiently skilled users.
Treat these commands like you would (or should) treat a chainsaw: with utmost care. 
Do not use them if you do not fully understand what they do or how they do it.
Any damage caused using these commands is completely your own responsibility.



How many users are logged on/connected to a server?

Sometimes we may need to know how many users are logged on to a (file) server, like maybe when there is a performance degradation.
At the server's console itself, with native commands only:

    NET SESSION | FIND /C "\\"
Remotely, with the help of SysInternals' PSTools:
    PSEXEC \\servername NET SESSION | FIND /C "\\"
By replacing FIND /C "\\" by FIND "\\" (removing the /C switch) you'll get a list of logged on users instead of just the number of users.


Who is logged on to a computer?

We often need to know who is currently logged on to a remote computer.
With native Windows (up to and including XP) commands only:

    NBTSTAT -a remotecomputer | FIND "<03>" | FIND /I /V "remotecomputer"
The first name in the list usually is the logged on user (try playing with the NET NAME command to learn more about the names displayed by NBTSTAT).
This is the 
fastest way to find the logged on user name, and the results that you do get are correct, but NBTSTAT won't always return a user name, even when a user is logged on.
Note:
Unfortunately, NBTSTAT is no longer available in Windows 7 (not sure about Vista)
Using WMIC (Windows XP Professional and later):
    WMIC /Node:remotecomputer ComputerSystem Get UserName
This is arguably the most reliable (native) command to find out who is logged on.
With the help of SysInternals' PSTools:
    PSLOGGEDON -L \\remotecomputer
or:
    PSEXEC \\remotecomputer NET CONFIG WORKSTATION | FIND /I " name "
or:
    PSEXEC \\remotecomputer NET NAME
or for Windows XP only:
    PSEXEC \\remotecomputer NETSH DIAG SHOW COMPUTER /V | FIND /i "username"
Using REG.EXE (Windows 2000 and later):
    FOR /F %%A IN ('REG Query \\remotecomputer\HKU ˆ| FINDSTR /R /B /C:"HKEY_USERS\\S-1-5-[0-9][0-9]-[0-9-]*$"') DO (
               FOR /F "tokens=3 delims=\" %%B IN ('REG Query "\\remotecomputer\%%A\Volatile Environment"') DO (
                       SET LoggedinUser=%%B
               )
        )
or for Windows 7:
    FOR /F %%A IN ('REG Query \\remotecomputer\HKU /K /F "S-1-5-21-" ˆ| FINDSTR /R /B /C:"HKEY_USERS\\S-1-5-[0-9][0-9]-[0-9-]*$"') DO (') DO (
               FOR /F "tokens=2*" %%B IN ('REG Query "\\remotecomputer\%%~A\Volatile Environment" /V "UserName" ˆ| FIND /V ":"') DO (
                       SET LoggedinUser=%%C
               )
        )
NETSH and WMIC are for XP or later, and are the most reliable of all commands shown here.
WMIC requires WMI enabled remote computers and Windows XP on the administrator's computer; NETSH requires Windows XP on the local and remote computers.
PSLOGGEDON is a more accurate solution than NBTSTAT, but it will return the last logged on user if no one is currently logged on.
The NET and NBTSTAT commands show more or less identical results, but the NBTSTAT command is much faster.
The REG command is accurate, but may need to be modified depending on the version used.
As displayed here, the code is written for REG.EXE 2.0 (Windows 2000) and later.
More information on REG versions can be found on my REG Query page.

For Windows NT 4 and 2000: use NBTSTAT (fast, but it won't always return the user name!), and only switch to REG if NBTSTAT doesn't return a user name (modify the REG command for Windows NT 4).
For Windows XP: if you want to search lots of computers for logged on users, I recommend you try 
NBTSTAT first (fast, but it won't always return the user name!), and only switch to NETSH, REG or WMIC (accurate) if NBTSTAT doesn't return a user name.
For Windows Vista and later: use 
REG or WMIC (accurate).
Credits: Jiří Janyška (WMIC command) and Matthew W. Helton (NETSH command).


What is this collegue's login name?

My collegues often forget to mention their logon account name when calling the helpdesk, and the helpdesk doesn't always ask either. I suppose they expect me to know all 1500+ accounts by heart.
With (native) Windows Server 2003 commands only:

    DSQUERY USER -name *lastname* | DSGET USER -samid -display
Note:
Windows Server 2003's "DSTools" will work fine in Windows 2000 and XP too, when copied.
Keep in mind, however, that 
some Windows Server 2003 Active Directory functionality is not available in Windows 2000 Active Directories.


What is the full name for this login name?

With the native NET command:
    NET USER loginname /DOMAIN | FIND /I " name "
With (native) Windows Server 2003 commands:
    DSQUERY USER -samid *loginname* | DSGET USER -samid -display
Note:
The NET command may seem more universal, because it requires neither Active Directory nor Windows Server 2003 commands, but it is language dependent!
For non-English Windows you may need to modify FIND's search string.


What groups is this user a member of?

In Windows NT 4 and later, users usually are members of global groups. These global groups in turn are members of (domain) local groups. Access permissions are given to (domain) local groups.
To check if a user has access to a resource, we need to check group membership 
recursively.
With (native) Windows Server 2003 commands:

    DSQUERY USER -samid loginname | DSGET USER -memberof -expand


What permissions does a user have on this directory?

One could use the previous command to check what permissions a user has on a certain directory.
However, sometimes 
SHOWACLS from the Windows Server 2003 Resource Kit Tools is a better alternative:
    CD /D d:\directory2check
        SHOWACLS /U:domain\userid


When did someone last change his password?

With the native NET command:
    NET USER loginname /DOMAIN | FIND /I "Password last set"


How do I reset someone's password?

With the native NET command:
    NET USER loginname newpassword /DOMAIN
With (native) Windows Server 2003 commands:
    DSQUERY USER -samid loginname | DSMOD USER -pwd newpassword
Note:
To prevent the new password from being displayed on screen replace it with an asterisk (*); you will then be prompted (twice) to type the new password "blindly".


Is someone's account locked?

With the native NET command:
    NET USER loginname /DOMAIN | FIND /I "Account active"
The account is either locked ("Locked") or active ("Yes").


How to unlock a locked account

With the native NET command:
    NET USER loginname /DOMAIN /ACTIVE:YES
or, if the password needs to be reset as well:
    NET USER loginname newpassword /DOMAIN /ACTIVE:YES


Make sure a local user's password never expires

With WMIC (Windows XP Professional or later):
    WMIC.EXE /Node:remotecomputer Path Win32_UserAccount Where Name="user" Set PasswordExpires="FALSE"


Make sure a local user's password will expire

With WMIC (Windows XP Professional or later):
    WMIC.EXE /Node:remotecomputer Path Win32_UserAccount Where Name="user" Set PasswordExpires="TRUE"


List all domains and workgroups in the network

With the native NET command:
    NET VIEW /DOMAIN


List all computers in the network

With the native NET command:
    NET VIEW
or, to list the names only:
    FOR /F "skip=3 delims=\     " %%A IN ('NET VIEW') DO ECHO.%%A
delims is a backslash, followed by a tab and a space.


List all domain controllers

With native Windows 2000 commands:
    NETDOM QUERY /D:MyDomain DC
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.
With (native) Windows Server 2003 commands (Active Directory only):
    DSQUERY Server
or, if you prefer host names only (tip by Jim Christian Flatin):
    DSQUERY Server -o rdn


Find the primary domain controller

With native Windows 2000 commands:
    NETDOM QUERY /D:MyDomain PDC
or, to find the FSMO with (native) Windows Server 2003 commands (Active Directory only):
    NETDOM QUERY /D:mydomain.com FSMO
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.


List all member servers

With native Windows 2000 commands:
    NETDOM QUERY /D:MyDomain SERVER
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.


List all workstations

With native Windows 2000 commands:
    NETDOM QUERY /D:MyDomain WORKSTATION
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.


Delete a computer account

With native Windows 2000 commands:
    NETDOM /DOMAIN:MyDomain MEMBER \\computer2Bdeleted /DELETE
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.


"I need an up-to-date list of disk space usage for all servers, on my desk in 5 minutes"

Sounds familiar?
With (native) Windows XP Professional or Windows Server 2003 commands:
    FOR /F %%A IN (servers.txt) DO (
               WMIC /Node:%%A LogicalDisk Where DriveType="3" Get DeviceID,FileSystem,FreeSpace,Size /Format:csv | MORE /E +2 >> SRVSPACE.CSV
        )
The only prerequisites are:
  1. SRVSPACE.CSV should not exist or be empty,
  2. a list of server names in a file named SERVERS.TXT, one server name on each line,
  3. and WMIC.EXE, which is native in Windows XP Professional, Windows Server 2003 and Vista.
The CSV file format is ServerName,DeviceID,FileSystem,FreeSpace,Size (one line for each harddisk partition on each server).
If you have a strict server naming convention, SERVERS.TXT itself can be generated with the NET command:
    FOR /F "delims=\    " %%A IN ('NET VIEW ^| FINDSTR /R /B /C:"\\\\SRV\-"') DO (>>SERVERS.TXT ECHO.%%A)
Notes:
(1)
assuming server names start with "SRV-"; modify to match your own naming convention.
(2)
delims is a backslash, followed by a tab and a space.


List all drivers on any PC

With (native) Windows XP Professional or Windows Server 2003 commands:
    DRIVERQUERY /V /FO CSV > %ComputerName%.csv
Or, for remote computers:
    DRIVERQUERY /S remote_PC /V /FO CSV > remote_PC.csv


List all printers on any PC

With (native) Windows XP+ commands:
    WMIC /Node:remote_PC Path Win32_Printer Get DeviceID


List all local administrators

With (native) Windows NT 4+ commands:
    NET LOCALGROUP Administrators
Or, to remove header and footer lines:
        FOR /F "delims=[]" %%A IN ('NET LOCALGROUP Administrators ˆ| FIND /N "----"') DO SET HeaderLines=%%A
        FOR /F "tokens=*"  %%A IN ('NET LOCALGROUP Administrators') DO SET FooterLine=%%A
        NET LOCALGROUP Administrators | MORE /E +%HeaderLines% | FIND /V "%FooterLine%"


Locate rogue DHCP servers

Never had an "illegal" router wreaking havoc on your network yet...?
With a (native) Windows Server 2003 command:
    DHCPLOC -p local_IP_address [ valid_DHCP_server1 [ valid_DHCP_server2 [ .. ] ] ]
DHCPLOC.EXE is native in Windows Server 2003, and will run in Windows XP if copied/installed.
I didn't test this in Windows Server 2003 yet, but in Windows XP you need to press "d" to start the discovery, or "q" to quit.



Disable Windows Firewall for domain only

Disable the firewall only when the computer (e.g. a laptop) is connected to the domain:
    NETSH Firewall Set OpMode Mode = DISABLE Profile = DOMAIN


Completely disable Windows Firewall (not recommended)

Disable the firewall comletely (not recommended unless an alternative enterprise firewall is used that requires you to do so):
    SC [ \\Remote_computer ] Stop SharedAccess
        SC [ \\Remote_computer ] Config SharedAccess start= disabled


Is IP v4 supported on this computer?

Check if IP v4 is supported on the local computer:
    PING 127.0.0.1 | FIND "TTL=" >NUL 2>&1
        IF ERRORLEVEL 1 (ECHO IP v4 NOT supported) ELSE (IP v4 supported)
or:
    WMIC Path Win32_PingStatus WHERE "Address='127.0.0.1'" Get StatusCode /Format:Value | FINDSTR /X "StatusCode=0" >NUL 2>&1
        IF ERRORLEVEL 1 (ECHO IP v4 NOT supported) ELSE (IP v4 supported)
The WMIC command is faster, but requires Windows XP Professional or later.


Is IP v6 supported on this computer?

Check if IP v6 is supported on the local computer:
    PING ::1 | FINDSTR /R /C:"::1:[ˆ$]" >NUL 2>&1
        IF ERRORLEVEL 1 (ECHO IP v6 NOT supported) ELSE (IP v6 supported)
or:
    WMIC Path Win32_PingStatus WHERE "Address='::1'" Get StatusCode >NUL 2>&1
        IF ERRORLEVEL 1 (ECHO IP v6 NOT supported) ELSE (IP v6 supported)
The WMIC command is faster, but requires Windows XP Professional or later.

Thursday, March 2, 2017

[Windows: MS Visual Studio on Linux]: Install Microsoft Visual Studio Code In Linux

Install Microsoft Visual Studio Code In Linux


Install Microsoft Visual Studio Code In Linux

Microsoft Visual Studio Code is an open source, lightweight and powerful source code editor. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Python, PHP, Go) and runtimes (such as .NET and Unity). It is a cross-platform code editor, so you can use it in Microsoft Windows, GNU/Linux, and Mac OS X.


Visual Studio Code version 1.10 has been just released and is available for download. The latest version has brought number of significant updates such as Minimap, easy drag and support within the editor, copy text with formatting, official Linux repositories, integrated Terminal output, keybindings for tasks and file explorer, Copy code examples with full syntax highlighting and more.  For more details, check the release notes.
In this tutorial, we are going to see how to install latest Visual Studio Code editor in Linux.

Install Microsoft Visual Studio Code In Linux

Microsoft developers has made VS Code repositories for different Linux distributions to ease the installation.
On Ubuntu and its derivatives, run these commands to to import singing key VS Code repository:
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
Then, update the repository lists and install VS Code as shown below.
sudo apt-get update
sudo apt-get install code
On RHEL, CentOS, Fedora, run the following commands to import singing key VS Code repository:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
Update the package cache and install VS Code as shown below.
yum check-update
sudo yum install code
On SUSE/openSUSE, run the following commands to import singing key VS Code repository.
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/zypp/repos.d/vscode.repo'
Update the package cache and install VS Code as shown below.
sudo zypper refresh
sudo zypper install code
Once installed, you can open the VS Code editor using command:
code
If you see a screen something like below, congratulations! You have successfully installed Microsoft Visual Studio Code in your Linux distribution.
Microsoft Visual Studio Code Editor
You can make VS Code as default text editor for text files with the following command:
xdg-mime default code.desktop text/plain
I have installed MS Visual Studio Code, now what? Refer the following links to getting started with Visual Code.
And, that’s all for now. Have you tried Visual studio in Linux? What is your thoughts about it? Give us your feedback in the comment section below.
Cheers!
Resource: