Archives

Category Archive for: ‘Deployment’
DNSMASQ as DHCP Proxy to Enable PXE on your network

In my office-network I like to have simple solutions instead of very complex ones. But still I like to have sophisticated functionality. One of this is PXE support to boot from the network. My Qnap nas has the option to act as a TFTP server to transfer the files to the computers.

Since I am using a Fritzbox as modem, firewall and router which does not have much options in the DHCP server to configure it will be a challenge to put the PXE options in it.

One option is to replace the firmware on the Fritzbox with a custom firmware and add dnsmasq for DNS and DHCP service. The down-side of this is that I break the default installation, maybe it will be unstable afterwards and maybe more things.

So, I looked around and found the there is a standard which is Proxy DHCP. Microsoft is using this technology in his WDS (Windows Deployment Server). So you don’t have to alter the DHCP server to enable it.

DNSMasq can also used to act as a Proxy DHCP. You have to use the following configuration for this:

port=0
log-dhcp
dhcp-boot=pxelinux.0
dhcp-option=vendor:PXEClient,6,2b
pxe-service=X86PC, "Boot from network", pxelinux
dhcp-no-override
dhcp-range=192.168.79.0,proxy,255.255.255.0
#enable-tftp                                          # if you also like to enable DNSmasq as TFTP server
#tftp-root=/tftpboot/                      # if you also like to enable DNSmasq as TFTP server

I installed DNSMasq on my QNap NAS. But you can also run dnsmasq on any other Linux distribution, or even look for another Proxy DHCP service.

UAC with VBscript

You know this? Like to run an VBscript with elevated rights but the User Account Control (UAC) is preventing it. Normally you will open the Command Line as Administrator, and run your script. There is an more easy way to do this.

When you include the following code in your VBscript:

Option Explicit

' Windows UAC Settings for this script
Dim UAC
UAC=True

'this is at the start of your script
CheckStartModeUAC

' msgbox or your own program :)
Msgbox "UAC right now!"

Sub CheckStartModeUAC
	' Force to start with elevated prompt if neccessary on that OS
	If UACTurnedOn = True And UAC=True Then
		' UAC Enabled
	
		' Returns the running executable as upper case from the last \ symbol
		Dim strStartExe, oSh, completearguments, x
		
		' Receive launcher
		strStartExe = UCase( Mid( wscript.fullname, instrRev(wscript.fullname, "\") + 1 ) )
		
		' Collect arguments
		for x = 0 to wscript.arguments.count - 1
			completearguments = completearguments & " """ & wscript.arguments(x) & """"
		next
		
		If Instr(completearguments, "uac") then
			' Already launched with uac
		Else
			' Launch this script in UAC mode
			completearguments = completearguments & " uac"
			'Msgbox strStartExe & " """ & wscript.scriptfullname & """ " & completearguments
			
			set oSh = CreateObject("Shell.Application")
			
			oSh.ShellExecute strStartExe, """" & wscript.scriptfullname & """ " & completearguments, "", "runas", 1
			'oSh.ShellExecute strStartExe, wscript.scriptfullname & " " & completearguments, "runas", 1
			wscript.quit
		End if
	End If	
End Sub

Function UACTurnedOn ()
	' Check for UAC enabled computer
	 On Error Resume Next
	 
	 Dim oShell

	 Set oShell = CreateObject("WScript.Shell")
	 If oShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA") = 0 Then
		  UACTurnedOn = false
	 Else
		  UACTurnedOn = true
	 End If
End Function

You will get the popupbox when you double-click on the script. Maybe you have to change your script a little bit, but it is still nice :)

12