Script runs through a list of printers, comparing against the Windows event log to see if the print queue is still in use. This assumes you have set the print server to log successful print jobs.  The company I work for has about 450 printers on a particular server,  so it took a fair while to pull and process all the logs.

Create a txt file called printerports.txt that contains a list of printer names

#Title: Enumerate Active/Inactive Printers
#Loops through event logs on print servers to ascertain whether a given print queue is in use.
#Set variables
$hostname = "xxxxxxx" #Name of server you wish to run this script against
$thisDate = (get-date).addmonths(-6)  #how far back to obtains logs. Must be negative!

#Load files/event log
$printerports = Get-Content "C:\PrinterPorts.txt" #Text file containing names of printers
$events=get-eventlog -Logname system -ComputerName $hostname|where {($_.eventid -eq 10) -and ($_.timewritten -gt $thisDate)} #get system logs from hostname, filter all event ids bar 10 (successful print)
#$events = Get-Content "logs.txt" #Text file containing the event logs - less cpu/network intensive than doing live

#loop through each printer listed in printerports.txt
foreach($line in $printerports)
    $counter = 0
    $found = 0
    while ($counter -lt $events.count)

        #if the current event contains the printer name, report in use        

        if ($events[$counter].message -match $line)
            write-host $line " is in use"
            $found = 1

    #if above while does not locate printerport within the logs, report not in use
    if ($found -eq 0)
        write-host $line " is NOT used"

, , , , , ,

VirtualBox and Windows 8 Beta (Developer Edition)

There is a little trick to getting Windows 8 beta to install in VirtualBox. Open the machine settings and change the following in System:

  1. Set Chipset to ICH9
  2. Enable IO APIC
Ta-da, Windows 8 will now install

, ,

Publish printer objects to AD by command line tool

Notice the above search in Google results in multiple sites that seemingly replicate the same post – one without answers.

The command line tool to publish printers to AD is setprinter.

To publish a printer:

SetPrinter PrinterName 7 “dwAction=publish”

To unpublish all printers on the local machine:

SetPrinter “” 7 “dwAction=unpublish”

To republish all printers on a remote machine:

SetPrinter \\ServerName 7 “dwAction=republish”

, , , ,

Printer Migration Script

Printer migration script I wrote to move users print queues from one server to another (remembers default printer), mainly for my own reference. Remember to update the log location, and old/new print server variables.

'Migrates users print queues from one server to another, defined by NewPrintServer and OldPrintServer
'Retains Default queue
'Logs results to \\AUZMRMSRV200\Logs\printers\

On Error Resume Next

Const ForWriting = 2
Const ForReading = 1

Dim Result
Dim LogonServer
Dim UserName
Dim strComputer
Dim objLog
Dim ObjPrinter
Dim NewPrintServer, OldPrintServer
Dim strPrinterName
Dim strPrinterServer
Dim objWMIService
Dim strDefault
Dim PrinterArray
Dim ObjNetwork, ObjShell, ObjFSO


Function Initialize()
Set objNetwork = CreateObject ("Wscript.Network")
Set objShell = CreateObject ("WScript.Shell")
Set objFSO = CreateObject ("Scripting.FileSystemObject")
OldPrintServer = "AUZMRMSRV302"
NewPrintServer = "AUZMRMSRV200"

strComputer = "."
LogonServer = objShell.ExpandEnvironmentStrings("%logonserver%")
UserName = objShell.ExpandEnvironmentStrings("%username%")

Set objLog = objFSO.CreateTextFile ("\\AUZMRMSRV200\Logs\printers\" & UserName & ".log")
End Function

Function RemapPrinters()
'Clear error variable

'Connect to WMI service on local machine
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")

'Report any errors connecting to WMI
If Err.Number Then
objLog.Write Date() & " " & Time() & ": " & "Error accessing WMI on " & strComputer & ", Error #" & Err.Number & ": " & Err.Description & ")"

& VbCrLf
'Find default printer
strDefault = GetDefaultPrinter
objLog.Write Date() & " " & Time() & ": " & "Migrating users printers from " & OldPrintServer & " to " & NewPrintServer & VbCrLf
objLog.Write Date() & " " & Time() & ": " & "Default Printer: " & strDefault & VbCrLf & VbCrLf

'Enumerate all installed printers
Set colInstalledPrinters = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer")

'Loop through each installed printer, where printer is a confirmed network printer on OldPrintServer
For Each objPrinter in colInstalledPrinters
if Left(objPrinter.Name,len(OldPrintServer)+2) = "\\" & OldPrintServer then

objLog.Write Date() & " " & Time() & ": " & "Migrating " & objPrinter.Name & VbCrLf
PrinterArray = Split (objPrinter.Name , "\") ' "","",Servername,Printername
strPrinterName = PrinterArray(3)
strPrinterServer = PrinterArray(2)

'Confirm servername value is populated and is not using the new print server already
If (LCase(objPrinter.ServerName) <> "") and (LCase(objPrinter.ServerName) <> "\\" & NewPrintServer) then

'Is this printer the default?
blDefault = false
if strDefault = "\\" & OldPrintServer & "\" & strPrinterName then
blDefault = true
end if

'Add print queue from new server, make default if need be
If AddPrinter("\\" & NewPrintServer & "\" & strPrinterName, blDefault) = True Then
'Report Successful install
objLog.Write Date() & " " & Time() & ": " & "Migrated \\" & OldPrintServer & "\" & strPrinterName & " to " &

"\\" & NewPrintServer & "\" & strPrinterName & VbCrLf
'Remove old printer queue, assuming Addprinter worked - prevents printers from being lost altogether

End if

objLog.Write Date() & " " & Time() & ": " & "No change needed, already on new server" & VbCrLf
End If
objLog.Write Date() & " " & Time() & ": " & (VbCrLf)
End If
End If
End Function

Function AddPrinter(strPrintQueue, blDefault)
AddPrinter = False

'Attempt to add printer, using new server
objNetwork.AddWindowsPrinterConnection strPrintQueue
If Err.Number Then
objLog.Write Date() & " " & Time() & ": " & "The printer " & strPrintQueue & " cannot be mapped" & VbCrLf
objLog.Write Date() & " " & Time() & ": " & "Error code : " & Err.Number & ": " & Err.Description & VbCrLf
AddPrinter = True
End If

'Set printer as default if necessary
If blDefault then
objLog.Write Date() & " " & Time() & ": " & "Changing default printer -> " & strPrintQueue & VbCrLf
objNetwork.SetDefaultPrinter strPrintQueue
If Err.Number Then
objLog.Write Date() & " " & Time() & ": " & "Could not set as default" & VbCrLf
objLog.Write Date() & " " & Time() & ": " & "Error code : " & Err.Number & ": " & Err.Description & VbCrLf
End If
End If

End Function

Function RemovePrinter(strPrintQueue)

'Attempt to remove printer
objNetwork.RemovePrinterConnection strPrintQueue
If Err.Number Then
objLog.Write Date() & " " & Time() & ": " & "The printer " & strPrintQueue & " cannot be removed" & VbCrLf
objLog.Write Date() & " " & Time() & ": " & "Error code : " & Err.Number & ": " & Err.Description & VbCrLf
objLog.Write Date() & " " & Time() & ": " & "The printer " & strPrintQueue & " was successfully removed" & VbCrLf
End if

End Function

Function GetDefaultPrinter()
sRegVal = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
sDefault = ""
sDefault = objShell.RegRead(sRegVal)
sDefault = Left(sDefault ,InStr(sDefault, ",") - 1)
GetDefaultPrinter = sDefault

End Function

Function Finish()
End Function

, ,

Still here

Well, the Rapture should have occurred, yet I’m still here as is all the Christians I know. This proves you should take everything you hear with a grain of salt and study for the answers yourself. God has provided the Bible to us to do exactly that.

, , ,

More Rapture Nonsense

News sites and other media are continuing to “hype” up the coming rapture on the 22nd of May. CNN even went as far as travelling with believers of this theory whilst they travelled around trying to spread word.

As I mentioned in my previous post, there is clear evidence in the Bible that no-one knows the date or time the Rapture will occur.  There are also several conditions that must be met prior to Rapture.

  • Where is the rebuilt Temple ?
  • If the temple hasn’t been rebuilt, how can it be desecrated by the Antichrist?
  • Where is the Antichrist?
  • The institution of One World Government, Currency, and Religion
  • The battles against Israel by Russia and Iran
  • the return of jews to Israel

This theory of this group seemingly ignores/discounts large portions of Scripture. In turn such predictions give non-Christians one more reason to discount the Bible.  John Jeffres provides another example of this with the age of the earth:

For example, many secularists have dismissed the Bible because they assume that it teaches the world is only 6,000 years old. In reality, the Bible never makes such a claim about the Earth’s age. Instead, some well-intentioned Christians have misused the genealogies in the Bible to attempt to ascertain the date of creation.

Source: My Take: May 21st doomsday movement harms Christianity

, , ,

New Computer

After many years of using laptops, I’ve started thinking of building a PC. I use to build PCs frequently and was up with the hardware back then. Over time I got sick of lugging large PCs/Monitors around and built a small PC (mATX, Mini Case), and a while after I switched to a laptop and didnt look back.

Why am I looking to build a PC again? I would like more storage with redundancy than what external drives can provide. There are also certain Steam games I can’t play due to my laptops hardware.

So this is what Im looking at the moment:

Western Digital Scorpio 320G SATA 7200RPM 16M notebook HDD
Kingmax 8G(2x4G)PC-10600 1333MHZ DDR3
Lian Li PC-T60B ATX/Micro Test Bench Black
AMD Athlon II X4 640 3.0Ghz AM3 95W
Gigabyte GA-870A-UD3 AMD SB785 4xDDR3 8CH Audio GLAN SATA3 RAID USB3,0
Thermaltake TR2 470W PSU
Viewsonic VX2453MH 23.6″W LED 2ms DSUB SPK HDMI

You may ask why the notebook harddrive. The reason is the case I intend on getting. This will run the OS and leave me three bays for 3x2TB harddrives running RAID 5.

Of course RAID is not a backup, so will be looking to use my external drive for that and setting the drives up in a way so I can separate the important-must-backup data and stuff I can replace/redownload/etc.

The GFX card I’m not sure on – as I mentioned I stopped custom building a fair while ago and no longer up with recent developments. As far as I can tell, it will be more than up to the task of running what I want. I’m not concerned about running everything at max, but would like to play with an HD TV from time to time at the native resolution…

, , , , ,

The Rapture is coming May 21st?

I recently came across this article on a Canadian news website, declaring that May 21 is Judgment Day: Christian group

Fair to say this has generated a fair bit of discussion. The question is that is there any real basis for this date? You have to turn to the Bible to find out.

  • Matthew 24:36:  No one knows about that day or hour, not even the angels in heaven, nor the Son, but only the Father.
  • Matthew 24:42:  Therefore keep watch, because you do not know on what day your Lord will come.
  • Matthew 25:13:  Therefore keep watch, because you do not know the day or the hour.
  • Mark 13:32-33:  No one knows about that day or hour, not even the angels in heaven, nor the Son, but only the Father. Be on guard! Be alert! You do not know when that time will come.
  • Mark 13:35:  Therefore keep watch because you do not know when the owner of the house will come back–whether in the evening, or at midnight, or when the rooster crows, or at dawn.

These verses show that no-one bar God himself knows when the Rapture is going to occur. The same thing should be avoided when talking about the age of the earth – as soon as you place an exact number on it, some other information will come to light and your answer is proven incorrect. This is then used to “prove” that Christians are wrong, should not be listened to and discounted.

, , , ,

And the geek shall inherit the earth

Or something like that. I do think there is a fair bit of truth behind that misstatement. Look at what geeks have provided the world in terms of technology/science.

Its also sad to see, even bewildering, the sheer volume of geeks/nerds/what have you that follow evolution. They view Christians in the same light, although I notice anger creeps into it frequently.


Got myself a few toys recently, despite money being tight. One is an IBM server, which I have installed ESX server on it and intend to setup a virtual Domain Controller for my studies. It is a rack mount server, so it sounds like a tornado. Fortunately its now in the gargage.

I also got a Cobalt Cube, a net appliance that was discontinued a few years back. It runs a custom version of Red Hat Linux and is geared towards Internet/Intranet hosting. At the moment, I have it running Apache, Mysql and WordPress.  I was able to configure SAMBA on it as well, so with an extra drive it will become a basic NAS. I wish it were able to run FreeNAS though.


I’ll replace the green LED it has in the front with some blue ones, the blue case and green light clash a bit in my opinion.

In Six Days: Why 50 Scientists Choose to Believe in Creation

Why 50 Scientists Choose to Believe in Creation

Why 50 Scientists Choose to Believe in Creation

During a trip to Brisbane over Christmas, I visited a large second hand book store and found a copy of Why 50 Scientists Choose to Believe in Creation. It contains 50 scientists’ opinions on why they believe in a literal six day creation.


I am very much a practical, hands on person. While I believed the Bible to be Gods Word, I had no answers for evolutionists or even myself about my beliefs. Christians should be prepared and I certainly haven’t been.

I found this book very appealing. It goes it to a fair bit of detail, discussing DNA, genetics, biochemistry, yet keeps it in a format I can easily understand. The world is far more complex than I have ever considered! I especially liked the comparisons of the chances of mutation generating new information, rather than loosing it (the basis of Evolution), to a hurricane going through a scrap yard and assembling a fully operational Boeing 747.

A must read for anyone who believes in Creation, but do not have answers for the Evolution theory.

, ,

prev posts