Installing Dig on Windows 8.1

This post will show you how to install Dig (Domain Information Groper) on Windows 8.1. Dig is a DNS (Domain Name System) command that gives you lots more information than NSlookup, but is not installed on Windows by default.

Download from https://www.isc.org/downloads/

Under the BIND heading, click the download button of the “Current-stable” release.

Select current stable version
Select current stable version

 

Select your version (32-bit, 64-bit)

Download options of Dig for Windows
Download options of Dig for Windows

Right click on the download, select “Extract All…” and extract the package to your chosen location

Extract All menu
Extract menu

 

I’ve put it in C:\Program Files

extract files location
extract files location

Depending on where you extract the files, you may have to provide administrator permission (check the “Do this for all current items” check box and click Continue).

Give administrator permission to copy files
Confirm administrator permission to copy files

You can now use Dig via the command line by opening a command prompt, changing directory to where you copied the Dig.exe file and running the Dig command.

 

Running Dig straight from the extracted directory
Running Dig straight from the extracted directory

 

Advanced: adding Dig to your Path

If you would like to run the Dig command from anywhere in the command prompt (and you probably don’t want to always have to go to the the directory to just run the command) you have to add it to your Path.

Be careful when doing this.. you’ve been warned!

Right click on the windows button (usually bottom right of screen) and select “System”

Right click on Windows button (usually bottom right).
Right click on Windows button

 

Or search for “System” and select the result that just says “System”

Search for system and select system
Use the search function to find system

 

Select “Advanced system settings”

System screen, select Advanced System Settings
System

 

Select “Environment Variables…”

System Properties screen, select environment variables
System Properties screen

 

Under “System variables” select Path then “Edit…”

Select "Path" under System Variables

 

Go to the end of the “Variable value” input box, enter a semi colon directly after the last variable value (no space) followed by the path where you extracted your files. In my example, I have entered ;C:\Program Files\BIND9.10.0-P2.x64

Edit system variable, enter a semi colon then the path to the dig.exe

The end of my variable value text box contains:

C:\ProgramFiles(x86)\ATITechnologies\ATI.ACE\CoreStatic;%systemroot%\idmu\common;C:\ProgramFiles\BIND9.10.0-P2.x64

Click “OK” to close all the dialogue boxes.

You have to close your Command Prompt and open a new one for the
Path to be updated.
Tip: to check what’s in your path, type “path” at your command prompt.

You should now be able to run the “dig” command from any location in the command prompt.

Type dig -h at the prompt and you should see the help file.

Dig installed and added to the path variable

Type dig followed by a domain name to view the information.

 

Permission denied deleting user directories and files Windows SBS

I came across an issue removing user’s directories and files from Windows Small Business Server (SBS) 2011. Even though I was using my account that is in the Domain Administrators group that is an administrator on the server,.

I could delete some of the directories and files but not all of them and was met with a “Folder Access Denied”  advising that “you required permission from the computer’s administrator to make changes to this folder”.

Folder Access Denied. You need permission to perform this action.
Folder Access Denied

On some directories going to the Owner tab and manually selecting a new owner then deleting worked, but this is quite a slow and laborious process and didn’t work for all directories.

In the example below I’ll demonstrate how I overcame this using the command line. This example is for a user in the D:\Users\FolderRedirections directory (your user files may be located in a different area).

Open a command prompt as an administrator.

Navigate to the directory by using the “change directory” command.

D: cd Users\FolderRedirection\username
change directory to FolderRedirection

 

Use the “takeown” command to take ownership of the directories and folders (in this example I show it just for the Downloads directory).

The /F switch indicates the directory

/A gives ownership to the administrators group

/R recurse

/D Y gives the default answer of Y to take take ownership

(Use takeown /? to see full explanation)

takeown

I tried to delete the folders again but was greeted with the same prompt. Viewing the permissions I could see the administrators group had full permission but it still wouldn’t let me delete the files.

Using the command line again to run icacls.exe program command.

icacls-exe

processed file: Downloads Successfully processed 1 files; Failed processing 0 files
icacls result

Note, if you are doing this in PowerShell then you’ll have to hold the icacls parameters in a variable and pass it the the command.

 

Finally I could remove the directories.

I made this into a PowerShell script that I run to remove old user’s directories and files easily which I will post soon.

Note: on one occasion this didn’t work and after running the above process I had to go into the properties of the directory by right clicking and selecting properties and add my user account to full access (even though it was already in there).