Category Archives: Windows Desktop

Where am I logged into and as Whom?

Applies to: Windows

What are the quickest ways to determine the computer you are logged into, and with which credentials?

1. Determine Computer Name

In Command prompt:

hostname

hostname-cmd

This works equally well in PowerShell.

hostname-ps

2. Determine Logged-In User

whoami

whoami-cmd

Same for PowerShell.

whoami-ps

Resetting NTFS Permissions in Windows 7

Applies to: Windows 7

Here’s the scenario. A friend of mine gave me his old disk drive to have it copied to a new drive. The old drive had permissions set on files and folders. Some of the files were not accessible, I was getting “Access Denied”.

I tried to right-click/properties on the folders that were not accessible and changed their owner and changed permissions but some folders were still inaccessible not matter what I did.

After some research, it turned out the tool “cacls” that allows one to display or change ACLs (access control lists) can help to reset ACLs.

In Windows 7 it is called “icalcs”. To reset files permissions simply do this:

  1. Run “cmd” as Administrator
  2. Go to the drive or folder in question, for example:
    cd i:
  3. To reset all the files permissions, type:
    icacls * /T /Q /C /RESET

That is it!

After that, the files permissions were reset and I could access them just fine.

icacls is a handy tool to change permissions of files en masse.

Display entries in Windows DNS cache

Applies to: Windows

DNS search results are cached on local systems to prevent a lookup every time the search is required. Sometimes during troubleshooting it is helpful to see the contents of the DNS client cache. This recipe describes the process of viewing the Windows DNS cache.

To view the DNS cache on the local system, type the following command from a command prompt:

ipconfig /displaydns | more

The | more is optional and will pause the output after each screenful which may be helpful since the DNS cache can get large and the output format uses several lines per record.

A sample output from this command is shown below. This is an address lookup for the host microsoft.com. The Record Name and A (Host) Record lines show the request and answer. The Time To Live field shows the number of seconds before this entry expires.

microsoft.com
—————————————-
Record Name . . . . . : microsoft.com
Record Type . . . . . : 1
Time To Live  . . . . : 3597
Data Length . . . . . : 4
Section . . . . . . . : Answer
A (Host) Record . . . : 207.46.197.32

Clear DNS Cache Manually

Applies to: Windows, Cisco

When you use DNS to resolve hostnames to IP addresses or services end point addresses, you sometime may want to clear the DNS cache manually.

On Windows you can clear the DNS cache with the “ ipconfig /flushdns ” command.

On Cisco gear you can use the “ clear hosts * ” in enable mode.