DHCP Server Logs

There have been several instances where I have been trying to troubleshoot DHCP Issues live, or other cases when I needed to know what computer had a specific IP address in the past…. A useful way to find out this information is to use/view the DHCP server logs. The log keeps only the past 7 days of logs, but through backups, you can actually go back to any point in time.

The log it located at C:\Windows\System32\dhcp

The logs are named dhcpsrvlog-mon; dhcpsrvlog-tues, etc… you get the idea. There is also a separate log to DHCPv6 (IPv6) addreseses.



Also, along that lines, don’t specifically trust the DHCP Lease active/inactive status as indicated in the DHCP console. Sometimes a reservation is used for a device that is set statically, so DHCP will show inactive, while the address is actually in use. Also it might show active even though the device isn’t properly receiving an IP address.


VBScript: Drivespace

codeHere is a handy script that was written to gather the local hard drive storage, both avaliable and free, and appends to the file. This works great for places where you want to see a trend. I run this monthly, but you could run it weekly or whenever you want. It creates a sepereate file for each logical partition, and each entry is on a single line so it works great.

' Writes drive space to the Tools directory 
' Written by Jason Olson 
' Based on work by Inge B. (ibr@lyse.net)

' Get the available logical drives and load them into an array from WMI

Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") 
Set colItems = objWMIService.ExecQuery _ 
("SELECT * FROM Win32_LogicalDisk Where DriveType = 3") 

' Calculate scale

function freespace(drive, name, space, space2, filesys2) 
pct = round(space/space2 , 2)*100
if space >= 1073741824 then 
	space = Round(space / 1073741824, 2) 
	units = "GB" 
	elseif space >= 1048576 then 
	space = Round(space / 1048576, 2) 
	units = "MB" 
	elseif space >= 1024 then 
	space = Round(space / 1024, 2) 
	units = "KB" 
	units = "B" 
End If 
if space2 >= 1073741824 then 
	space2= Round(space2/ 1073741824, 2) 
	units2 = "GB" 
	elseif space2>= 1048576 then 
	space2=Round(space2/1048576, 2) 
	units2 = "MB" 
	elseif space2>= 1024 then 
	space2=Round(space2/1024, 2) 
	units2 = "KB" 
	units2 = "B" 
End If 
freespace = Date() & Chr(9) & " " & space2 & " " & units2 & Chr(9) & space & " " & units & " free " & Chr(9) & "(" & pct & "%) " & Chr(9) & filesys2
End function 

' Strips out the colon from the drive name so we can use it as a filename
function drivename(name) 
	drivename = left(name,1)
End function 

' Find the tools directory, create it if missing

For Each objItem In colItems
 fldrx = objItem.DeviceID & "\Tools\"
 set fso = CreateObject("Scripting.FileSystemObject")
 if NOT fso.FolderExists(fldrx) Then
    fso.CreateFolder (fldrx)
    fldcx = True
   Exit For
   End If
 Exit For

' Write the data to the tools directory

For Each objItem In colItems
 fs = freespace(objItem.DeviceID, objItem.VolumeName, objItem.FreeSpace, objItem.Size, objItem.FileSystem)
 drvlet = drivename(objItem.DeviceID)
 fsl = fldrx & "drivespace_" & drvlet & ".txt"
 set fso = CreateObject("Scripting.FileSystemObject")
 set f = fso.OpenTextFile(fsl, "8", True)

Powered by WordPress.com.

Up ↑