Showing posts with label Command Prompt. Show all posts
Showing posts with label Command Prompt. Show all posts

Thursday, March 19, 2015

Check the credential of mapped network drive by WMI

Assuming that you'd like to know the user name of mapped network drive. The easy way to find the user name by performing wmic on Command Prompt or PowerShell.

wmic netuse where localname="<Drive letter name>" get UserName /value


You don't need to provide administrator's credential to perform this command.

To check the user name by PowerShell, we can perform the following cmdlets.

Get-WmiObject -Class Win32_NetworkConnection | Select UserName


For PowerShell 3.0 or later, we can perform Get-CimInstance -ClassName Win32_NetworkConnection | Select UserName


By the way, there is a useful tool named WMI Explorer. It's easy for us to find the WMI class.

This posting is provided “AS IS” with no warranties, and confers no rights!

Saturday, December 20, 2014

DiskSpd

Jose Barreto, Microsoft Principal Program Manager with the High Availability and Storage team, wrote a grate post to use DiskSpd. DiskSpd is a storage testing tool to test the storage performance like I/Os, MB/s and so on. This tool is free and we can download it from http://aka.ms/DiskSpd. It isn't needed to install and we can perform it on command prompt or PowerShell console of an operating system.


This posting is provided “AS IS” with no warranties, and confers no rights!

Thursday, August 7, 2014

Move the IIS default path on Windows Server 2008 or later

For security reason, administrators might be needed to move the default IIS path, Inetpub, to non-system drive. 

According to KB2752331, IIS is a core Windows component and cannot be installed on a non-system drive and Moving the Inetpub folder structure completely off of the system drive is not supported.

It seems that Microsoft doesn't suggest moving the default IIS path to non-system drive and administrators can select to save websites or applications to other folders and drives.  

However, Microsoft recommended to move the Inetpub to a different partition to save space and improve security in Security Best Practices for IIS 8 article.

Anyway, Microsoft provided the script for us to moving to a different drive but the script isn't supported by Microsoft. Administrators might take their own risk to perform this script to move the IIS default path.

The script example like this.



Prerequisite


Lab
Assuming that administrator logged in the IIS server.

1. After installing IIS, launch "Command Prompt" as administrator.
2. Perform the script file like this.


Remark: D is a destination drive letter. Administrators have to provide the drive letter for moving.

3. Perform "xcopy c:\inetpub d:\inetpub /E /O /I" to copy all contents with ACL to a new IIS path.


As a result, the default contents of IIS have move to a new path. However, administrators shouldn't delete the original IIS default path on the system drive.

References:
Guidance for relocation of IIS 7.0 and IIS 7.5 content directories

Security Best Practices for IIS 8

IIS7: Moving the INETPUB directory to a different drive

This posting is provided “AS IS” with no warranties, and confers no rights!

Thursday, July 31, 2014

Allow local users or domain users changing IP address

Sometimes you may receive the request that a local or domain user would like to change the IP address of a notebook computer. To archive this goal, we might add the user to a local administrator group. Adding the user to be an administrator, the user can do all things like installing software on the notebook. You might want this happen. You'd like to let the user to change the IP address or network configuration related only. To prevent the above scenario, administrators might consider adding a user into local "Network Configuration Operators" group. The user under "Network Configuration Operators" group can manage the network connectivity of a computer so the user can change an IP address on the notebook.

To add a user into "Network Configuration Operators" group, administrators can launch "Computer Management" and then add the user into the group.


Or perform "net localgroup "Network Configuration Operators" /add <user name>" as a Command Prompt to add the user into the group.

This posting is provided “AS IS” with no warranties, and confers no rights!

Tuesday, July 1, 2014

Using nbtstat command to check the NetBIOS Domain Name

"Nbtstat" is a command to display NetBIOS over TCP/IP (NetBT). Yesterday, I needed to check the NetBIOS Domain name of the test environment so I performed "Nbtstat" command to check it. It's easy for us to check the NetBIOS Domain name by performing "Nbtstat" with parameters.

Check local NetBIOS Domain name
1. Launch "Command Prompt".
2. Perform "nbtstat -n".


The type is "Group" that is represent a NetBIOS Domain name or a workgroup name.


To confirm the NetBIOS Domain name, we can perform the following commands to check it.

Check remote NetBIOS Domain name
1. Launch "Command Prompt".
2. Perform "nbtstat -a <HostName>".


Remark: If I enter <Host Name>.<Domain Name>, there is no result.


3. If we cannot locate the <Host name>, we can perform "nbtstat -A <IP Address>" to check the remote NetBIOS Domain name.


More information

This posting is provided “AS IS” with no warranties, and confers no rights!