Just a quick post to prove that I'm still alive.
So much has changed with the economic downturn. Now instead of leading a team of 22, I'm a working lead of a group of 3.25, kinda. That explains why I'm working so much more and not posting. I've also changed technologies and am now learning all about Network Attached Storage. Fun fun fun.
anyway....
I'm alive.
An Analog Man in a Digital World
I'm in UR browser, suckin' up all UR ones and zeros!!!
Monday, May 25, 2009
Thursday, December 25, 2008
Happy Holidays
Happy Holidays, folks.
Merry Christmas.
Happy Hanukkah.
Happy Kwanzaa.
Enjoyable Druid non-religious week of celebration.
Happy Festivus (air your grievances here).
But most importantly, HAPPY LIFE.
Now, quit reading this drivel and go enjoy your families.
:)
Merry Christmas.
Happy Hanukkah.
Happy Kwanzaa.
Enjoyable Druid non-religious week of celebration.
Happy Festivus (air your grievances here).
But most importantly, HAPPY LIFE.
Now, quit reading this drivel and go enjoy your families.
:)
Sunday, October 26, 2008
More Fun with Windows Printers
Okay, so I suck at posting on a regular basis. I'm busy. Sorry.
Anyway...
If you follow this blog at all, you've probably reached the conclusion that I hate printers and print servers. You're partially right. I hate them because they're a pain in the butt, but I also enjoy them because they give me an opportunity to still do some technical stuff. Remember, I'm a manager now. I'm not supposed to be technical.
Previously I posted some code I adapted to monitor and generate statistics from my company's Windows print servers. Now I've worked on a script that runs with user rights to unmap and remap printers, correcting printer names and forcing the download of new drivers for each printer from the server. This is still a work in progress, but it works pretty darned well, even if I do say so myself. I was never very happy with anything I found on the Net, so this is my stab at this functionality. Please, feel free to give me advice for improvements, but also feel free to use this code at your own risk. I make no warranty of any of this code.
Anyway...
If you follow this blog at all, you've probably reached the conclusion that I hate printers and print servers. You're partially right. I hate them because they're a pain in the butt, but I also enjoy them because they give me an opportunity to still do some technical stuff. Remember, I'm a manager now. I'm not supposed to be technical.
Previously I posted some code I adapted to monitor and generate statistics from my company's Windows print servers. Now I've worked on a script that runs with user rights to unmap and remap printers, correcting printer names and forcing the download of new drivers for each printer from the server. This is still a work in progress, but it works pretty darned well, even if I do say so myself. I was never very happy with anything I found on the Net, so this is my stab at this functionality. Please, feel free to give me advice for improvements, but also feel free to use this code at your own risk. I make no warranty of any of this code.
'****************************************************
' Script by Brian E. Tower
' October 2008
'
' This script enumerates printers, determines which printers are
' mapped to specific print servers, makes a list of these printers
' corrects the server they are mapped to, deletes the mappings, deletes the drivers,
' remaps the printers with correct server names and resets the default printer.
'****************************************************
CheckRunner 'makes sure your running with cscript, not wscript
Dim arrMappedPrinters()
Dim arrNewMappings()
intSize = 0
Dim i, strCurrentDefaultPrinter, strRoot, strDelCmd, WshNetwork, strPrtr, strBits
On Error Resume Next
strBits = GetOS()
If strBits = 0 Then
WScript.Echo
WScript.Echo "You are running a 32 bit OS. Proceeding..."
WScript.Echo
'find default printer currently set and set a variable equal to it and change to the right print server
strCurrentDefaultPrinter = ChgPrntSrv(GetDefaultPrinter)
'find the system root, save for later
Set objShell = WScript.CreateObject( "WScript.Shell" )
strRoot = objShell.ExpandEnvironmentStrings("%SYSTEMROOT%")
'this is the executable to delete all unused print drivers
strDelCmd = strRoot & "\system32\cscript.exe " & strRoot & "\system32\prndrvr.vbs -x"
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objPrinters = WshNetwork.EnumPrinterConnections
WScript.Echo "Cataloging printer mappings:"
WScript.Echo
For i = 0 to objPrinters.Count - 1 Step 2
strPrtr = lcase(objPrinters.Item(i+1))
If InStr(1, strPrtr, "\\n1") <> 0 Then
'push unc into array
ReDim Preserve arrMappedPrinters(intSize)
ReDim Preserve arrNewMappings(intSize)
arrMappedPrinters(intSize) = strPrtr
'change server names and put in newprinter array
arrNewMappings(intSize) = ChgPrntSrv(arrMappedPrinters(intSize))
intSize = intSize +1
ElseIf InStr(1, strPrtr, "\\ac") <> 0 Then
'push unc into array
ReDim Preserve arrMappedPrinters(intSize)
ReDim Preserve arrNewMappings(intSize)
arrMappedPrinters(intSize) = strPrtr
'change server names and put in newprinter array
arrNewMappings(intSize) = ChgPrntSrv(arrMappedPrinters(intSize))
intSize = intSize +1
End If
Next
' remove printers
WScript.Echo "Deleting current mappings:"
For each strPrinterPath in arrMappedPrinters
WScript.Echo "Deleting " & strPrinterPath
WshNetwork.RemovePrinterConnection strPrinterPath, true, true
Next
' delete drivers
WScript.Echo
WScript.Echo "Deleting unused print drivers:"
Set oExec = objShell.Exec(strDelCmd)
' remap printers
WScript.Echo
WScript.Echo "Remapping printers:"
For Each strPrinterAdd in arrNewMappings
WScript.Echo "Mapping " & strPrinterAdd
WshNetwork.AddWindowsPrinterConnection strPrinterAdd
If Err <> 0 Then
WScript.Echo "Error mapping " & strPrinterAdd & ". You will need to map this printer manually."
DisplayErrorInfo
End If
'WScript.Sleep 1000
Next
'set default printer
WScript.Echo
WScript.Echo "Setting Default Printer:"
If Not strCurrentDefaultPrinter = "" then
WScript.Echo "Setting default printer to " & strCurrentDefaultPrinter
WshNetwork.SetDefaultPrinter strCurrentDefaultPrinter
Else
WScript.Echo "No default printer defined"
End If
Else
WScript.Echo
WScript.Echo
WScript.Echo "64 bit OS detected. This utility does not run on 64 bit OS"
WScript.Echo
WScript.Echo
End If
'****************************************************
' Functions and Notes below this point
'****************************************************
Function GetDefaultPrinter() 'this function finds the default printer setting for the current user
Set objShell = CreateObject("WScript.Shell")
strRegVal = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
strDefault = ""
On Error Resume Next
strDefault = objShell.RegRead(strRegVal)
strDefault = Left(strDefault ,InStr(strDefault, ",") - 1)
On Error Goto 0
GetDefaultPrinter = strDefault
End Function
Function ChgPrntSrv(strServer) 'this function converts old print server names to new print server names
If InStr(1, strServer, "\\n1ps01") <> 0 Then
ChgPrntSrv = Replace(strServer, "n1ps01", "n1print01")
ElseIf InStr(1, strServer, "\\n1ps02") <> 0 Then
ChgPrntSrv = Replace(strServer, "n1ps02", "n1print01")
ElseIf InStr(1, strServer, "\\n1ps03") <> 0 Then
ChgPrntSrv = Replace(strServer, "n1ps03", "n1print02")
ElseIf InStr(1, strServer, "\\n1ps04") <> 0 Then
ChgPrntSrv = Replace(strServer, "n1ps04", "n1print02")
ElseIf InStr(1, strServer, "\\n1prntsrv01") <> 0 Then
ChgPrntSrv = Replace(strServer, "n1prntsrv01", "n1print01")
ElseIf InStr(1, strServer, "\\n1prntsrv02") <> 0 Then
ChgPrntSrv = Replace(strServer, "n1prntsrv02", "n1print02")
ElseIf InStr(1, strServer, "\\acprnt01") <> 0 Then
ChgPrntSrv = Replace(strServer, "acprnt01", "acprint02")
ElseIf InStr(1, strServer, "\\acprnt02") <> 0 Then
ChgPrntSrv = Replace(strServer, "acprnt02", "acprint02")
ElseIf InStr(1, strServer, "\\acps02") <> 0 Then
ChgPrntSrv = Replace(strServer, "acps02", "acprint02")
ElseIf InStr(1, strServer, "\\acprnt03") <> 0 Then
ChgPrntSrv = Replace(strServer, "acprnt03", "acprint01")
ElseIf InStr(1, strServer, "\\acprnt04") <> 0 Then
ChgPrntSrv = Replace(strServer, "acprnt04", "acprint01")
ElseIf InStr(1, strServer, "\\acps01") <> 0 Then
ChgPrntSrv = Replace(strServer, "acps01", "acprint01")
Else
ChgPrntSrv = strServer
End If
End Function
Function GetOS() 'this function determines if the OS is 64 or 32 bit
Dim oWMI
Dim oOS, xOS
Dim oRX_Bit
Dim b64 'Boolean value. If true, it is 64Bit, else it's 32Bit.
Set oWMI = GetObject("winmgmts:")
Set oRX_Bit = New RegExp
oRX_Bit.Pattern = "x64"
oRX_Bit.IgnoreCase = True
Set oOS = oWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each xOS In oOS
If oRX_Bit.Test(xOS.Name) Then
b64 = True
Else
b64 = False
End If
Next
GetOS = b64
End Function
Sub DisplayErrorInfo
WScript.Echo "Error: : " & Err
WScript.Echo "Error (hex) : &H" & Hex(Err)
WScript.Echo "Source : " & Err.Source
WScript.Echo "Description : " & Err.Description
Err.Clear
End Sub
Sub CheckRunner
dim arrProgRun, intEnd, strExecute
arrProgRun = split(WScript.FullName, "\")
intEnd = Ubound(arrProgRun)
strExecute = arrProgRun(intEnd)
if not lcase(strExecute) = "cscript.exe" then
WScript.Echo "You must run this script with CScript. " & vbCrLf & "Please read the instructions!!!" & vbCrLf & vbCrLf & "Bet you clicked an icon."
WScript.Quit (1)
end if
End Sub
Tuesday, September 9, 2008
Auditing Windows 2003 Print Servers
As many of you know I lead a team that manages a large number of Windows servers - along with other stuff - for a large corporation. One of the most dreaded things we deal with are print servers. In general, they're just a pain, but I digress.
A while back I was trying to come up with a way to audit the print servers to determine who was using each queue, how many pages were being printed by each queue, which queues were actually being used, etc. Much to my surprise, there were no programs or tools available that do what I want. Not even from Uncle Bill's big blue company. Not even Open Source. Then I found this really good blog with a script that did about 90 percent of what I need, written by a gentleman in Brisbane Australia named Wayne. For a full explanation of how to use these scripts, please see Wayne's blog.
To make a long story short, I took Wayne's script and in the spirit of open source modified it to do what I needed it to do. Now I'm returning the script to the "wild" and hoping some other lucky slob finds it useful.
So, here's my version of the ProcessPrinterLogs.vbs script originally posted by Wayne.
---
---
The other big change I made was in the wrapper batch file that pulls down the log files. I changed it so that a single script loops through a list of print servers.
Here's my version of the auditprinters.bat script.
---
Okay, so there it is. Enjoy! Use it in good health and for non nefarious purposes!
A while back I was trying to come up with a way to audit the print servers to determine who was using each queue, how many pages were being printed by each queue, which queues were actually being used, etc. Much to my surprise, there were no programs or tools available that do what I want. Not even from Uncle Bill's big blue company. Not even Open Source. Then I found this really good blog with a script that did about 90 percent of what I need, written by a gentleman in Brisbane Australia named Wayne. For a full explanation of how to use these scripts, please see Wayne's blog.
To make a long story short, I took Wayne's script and in the spirit of open source modified it to do what I needed it to do. Now I'm returning the script to the "wild" and hoping some other lucky slob finds it useful.
So, here's my version of the ProcessPrinterLogs.vbs script originally posted by Wayne.
---
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Main()
Sub Main()
If WScript.Arguments.Named.Exists("f") Then
sSource = Wscript.Arguments.Named("f")
Else
Wscript.Arguments.ShowUsage()
Wscript.Echo "Source file or directory must be supplied"
Wscript.Quit(2)
End If
If Wscript.Arguments.Named.Exists("o") Then
sOutputFile = Wscript.Arguments.Named("o")
Else
dNow = Now
dLogDate = DatePart("yyyy", dNow)
dLogDate = dLogDate & String(2 - Len(DatePart("m", dNow)),"0") & DatePart("m", dNow)
dLogDate = dLogDate & String(2 - Len(DatePart("d", dNow)),"0") & DatePart("d", dNow)
sOutputFile = Left(WScript.ScriptName, InStrRev(WScript.ScriptName,".vbs")-1) & "_" & dLogDate & ".csv"
End If
wscript.echo "Input file/dir: '" & sSource & "'"
wscript.echo "Output file: '" & sOutputFile & "'"
If objFSO.FileExists(sSource) Then
sFileSet = sSource ' Process a single file
wscript.echo "Single file specified - " & sFileSet
ElseIf objFSO.FolderExists(sSource) Then
wscript.echo "Source specified was a directory, reading files from '" & sSource & "'"
sFileSet = ""
Set oFolder = objFSO.GetFolder(sSource) ' Get the folder
Set oFiles = oFolder.Files
For Each oFile in oFiles ' For each file
sFileset = sFileset & vbCRLF & oFile.Path ' Append to the fileset
Next
If Len(sFileSet) > Len(vbCRLF) Then sFileSet = Right(sFileSet, Len(sFileSet) - Len(vbCRLF)) ' Trim the leading CRLF
End If
Set dPrinters = CreateObject("Scripting.Dictionary") ' Create the dictionary objects
Set dUsersPerPrinter = CreateObject("Scripting.Dictionary")
Set dusers = CreateObject("Scripting.Dictionary")
Set dDates = CreateObject("Scripting.Dictionary")
Set dJobs = CreateObject("Scripting.Dictionary")
For Each sFile in Split(sFileset, vbCRLF) ' For Each file
Set objFile = objFSO.GetFile(sFile)
If objFile.size > 0 then ' Don't process the file if it is a 0 byte file
wscript.echo "Processing '" & sFile & "'"
sBuffer = ""
Set objTextStream = objFSO.OpenTextFile(sFile, ForReading)
sBuffer = objTextStream.ReadAll
For Each sLine in Split(sBuffer, vbCRLF) ' For each line in this file
Call ProcessLogEntry(sLine, dPrinters, dUsers, dDates, dJobs, dUsersPerPrinter) ' Process the log entry
Next
End If
Next
Call ProduceOutput(sOutput, dPrinters, dUsers, dDates, dJobs, dUsersPerPrinter) ' Produce the output
Set objTextStream = objFSO.OpenTextFile(sOutputFile, ForWriting, True)
objTextStream.Write sOutput
wscript.echo "Output saved to '" & sOutputFile & "', " & Len(sOutput) & " characters."
End Sub
Function ProduceOutput(ByRef sOutput, ByRef dPrinters, ByRef dUsers, ByRef dDates, ByRef dJobs, ByRef dUsersPerPrinter)
Dim strPrinter, strPort, dtmDate, strUser, strserver, strDocumentName, intSize, intPages, strInformation, strTotal
Dim strUserTotal, strPrinterTotal, strDateTotal, strJobTotal, aJobTotal
sOutput = ""
For Each strPrinter in dPrinters.Keys
sOutput = sOutput & vbCRLF & strPrinter & "," & dPrinters.Item(strPrinter)
Next
sOutput = sOutput & vbCRLF
For Each strUser in dUsers.Keys
sOutput = sOutput & vbCRLF & strUser & "," & dUsers.Item(strUser)
Next
'new portion to output list of users per print queue
sOutPut = sOutput & vbCRLF
For Each strPrinter in dUsersPerPrinter.Keys
sOutput = sOutput & vbCRLF & strPrinter & "," & dUsersPerPrinter.Item(strPrinter)
Next
'end of new output
sOutput = sOutput & vbCRLF
For Each dtmDate in dDates.Keys
sOutput = sOutput & vbCRLF & dtmDate & "," & dDates.Item(dtmDate)
Next
sOutput = sOutput & vbCRLF
For Each strTotal in dJobs.Keys
strJobTotal = dJobs.Item(strTotal)
aJobTotal = Split(strJobTotal, ",")
sOutput = sOutput & vbCRLF & "Total Jobs," & aJobTotal(0)
sOutput = sOutput & vbCRLF & "Total Pages," & aJobTotal(1)
sOutput = sOutput & vbCRLF & "Total Size (MB)," & aJobTotal(2)
Next
sOutput = sOutput & vbCRLF
strUserTotal = UBound(dUsers.Keys)+1
strPrinterTotal = UBound(dPrinters.Keys)+1
strDateTotal = UBound(dDates.Keys)+1
sOutput = sOutput & vbCRLF & "Printers," & strPrinterTotal
sOutput = sOutput & vbCRLF & "Users," & strUserTotal
sOutput = sOutput & vbCRLF & "Days," & strDateTotal
aJobTotal = Split(strJobTotal, ",")
sOutput = sOutput & vbCRLF
sOutput = sOutput & vbCRLF & "Average jobs/person," & CInt(aJobTotal(0)/strUserTotal)
sOutput = sOutput & vbCRLF & "Average pages/person," & CInt(aJobTotal(1)/strUserTotal)
sOutput = sOutput & vbCRLF & "Average pages/person/day," & CInt(CInt(aJobTotal(1)/strUserTotal) / strDateTotal)
sOutput = sOutput & vbCRLF & "Average pages/minute," & CInt(aJobTotal(1) / (strDateTotal * 8 * 60))
End Function
Function ProcessLogEntry(ByRef sLine, ByRef dPrinters, ByRef dUsers, ByRef dDates, ByRef dJobs, ByRef dUsersPerPrinter)
Dim strPrinter, strPort, dtmDate, strUser, strserver, strDocumentName, intSize, intPages, strInformation
Dim aPrintJob, intOffset, strTemp, aTemp
aPrintJob = Split(sLine, vbTAB)
If UBound(aPrintJob) = 9 Then
dtmDate = aPrintJob(0) ' & " " & aPrintJob(1)
aTemp = Split(dtmDate, "/")
dtmDate = Right("00" & Trim(aTemp(1)), 2) & "/" & Right("00" & Trim(aTemp(0)), 2) & "/" & aTemp(2) ' Trim, pad and switch to dd/mm/yyyy instead of mm/dd/yyyy
strServer = aPrintJob(8)
strInformation = Trim(aPrintJob(9))
strInformation = Right(strInformation, Len(strInformation) - InStr(strInformation, " ")) ' Remove the job ID
intOffset = InStrRev(strInformation, " ")
intPages = Right(strInformation, Len(strInformation) - intOffset) ' Extract the number of pages from the end
strInformation = Left(strInformation, intOffset-1) ' Trim the string
intOffset = InStrRev(strInformation, " ")
intSize = Right(strInformation, Len(strInformation) - intOffset) ' Extract the number of bytes from the end
strInformation = Left(strInformation, intOffset-1) ' Trim the string
intOffset = InStrRev(strInformation, " ")
strPort = Right(strInformation, Len(strInformation) - intOffset) ' Extract the port from the end
strInformation = Left(strInformation, intOffset-1) ' Trim the string
intOffset = InStrRev(strInformation, " ")
strPrinter = Right(strInformation, Len(strInformation) - intOffset) ' Extract the printer from the end
strInformation = Left(strInformation, intOffset-1) ' Trim the string
intOffset = InStrRev(strInformation, " ")
strUser = Right(strInformation, Len(strInformation) - intOffset) ' Extract the user from the end
strInformation = Left(strInformation, intOffset-1) ' Trim the string
strDocumentName = strInformation
If dPrinters.Exists(strPrinter) Then ' Does this printer already exist in the dictionary?
aTemp = Split(dPrinters.Item(strPrinter), ",") ' Find the existing printer job/page count
aTemp(0) = aTemp(0) + 1 ' Increment the job count
aTemp(1) = aTemp(1) + CInt(intPages) ' Add to the page count
aTemp(2) = aTemp(2) + CInt(intSize/1024/1024) ' Add to the byte count
dPrinters.Item(strPrinter) = Join(aTemp, ",") ' Update the dictionary
Else
aTemp = Array(1, intPages, CInt(intsize /1024/1024)) ' Start the job/page count
dPrinters.Add strPrinter, Join(aTemp, ",") ' Create this item
End If
If dUsers.Exists(strUser) Then ' Does this user already exist in the dictionary?
aTemp = Split(dUsers.Item(strUser), ",") ' Find the existing user job/page count
aTemp(0) = aTemp(0) + 1 ' Increment the job count
aTemp(1) = aTemp(1) + CInt(intPages) ' Add to the page count
aTemp(2) = aTemp(2) + CInt(intSize/1024/1024) ' Add to the byte count
dUsers.Item(strUser) = Join(aTemp, ",") ' Update the dictionary
Else
aTemp = Array(1, intPages, CInt(intsize /1024/1024)) ' Start the job/page count
dUsers.Add strUser, Join(aTemp, ",") ' Create this item
End If
If dDates.Exists(dtmDate) Then ' Does this date already exist in the dictionary?
aTemp = Split(dDates.Item(dtmDate), ",") ' Find the existing date job/page count
aTemp(0) = aTemp(0) + 1 ' Increment the job count
aTemp(1) = aTemp(1) + CInt(intPages) ' Add to the page count
aTemp(2) = aTemp(2) + CInt(intSize/1024/1024) ' Add to the byte count
dDates.Item(dtmDate) = Join(aTemp, ",") ' Update the dictionary
Else
aTemp = Array(1, intPages, CInt(intsize /1024/1024)) ' Start the job/page count
dDates.Add dtmDate, Join(aTemp, ",") ' Create this item
End If
If dJobs.Exists(JOB_TOTAL) Then ' Does the total already exist in the dictionary?
aTemp = Split(dJobs.Item(JOB_TOTAL), ",") ' Find the existing total counts
aTemp(0) = aTemp(0) + 1 ' Increment the job count
aTemp(1) = aTemp(1) + CInt(intPages) ' Add to the page count
aTemp(2) = aTemp(2) + CInt(intSize/1024/1024) ' Add to the byte count
dJobs.Item(JOB_TOTAL) = Join(aTemp, ",") ' Update the dictionary
Else
aTemp = Array(1, intPages, CInt(intsize /1024/1024)) ' Start the job/page count
dJobs.Add JOB_TOTAL, Join(aTemp, ",") ' Create this item
End If
' This section creates a list of users that are using each print queue
If dUsersPerPrinter.Exists(strPrinter) Then ' Does the printer exist as a key in the dictionary?
dim bTemp
bTemp = dUsersPerPrinter.Item(strPrinter) & "," & strUser ' build up the list of users
dUsersPerPrinter.Item(strPrinter) = DedupeString(bTemp,",") ' dedupe sting of users and populate dictionary
Else
dUsersPerPrinter.Add strPrinter, strUser ' Create this item
End If
' End of user list creation
Else
wscript.echo "skipped '" & sLine & "'" ' line skipped because number of elemnts in array not equal to 9 ( need to figure this one out)
End If
End Function
' Deduping a string
' must use this function so we end up with a unique list of users with no duplicates
Function DedupeString(inString,strSeperate)
Dim vObjects, myDict, index, strFinal
strFinal = ""
Set myDict = CreateObject("Scripting.Dictionary")
vObjects = split(inString,strSeperate)
for index = 0 to UBound(vObjects)
if ( not myDict.Exists(vObjects(index)) ) then
myDict.Add vObjects(index), vObjects(index)
if (Len(strFinal)) > 0 Then
strFinal = strFinal & strSeperate & myDict(vObjects(index))
else
strFinal = myDict(vObjects(index))
end if
end if
next
DedupeString = strFinal
End Function
---
The other big change I made was in the wrapper batch file that pulls down the log files. I changed it so that a single script loops through a list of print servers.
Here's my version of the auditprinters.bat script.
---
---
:: bet_auditprint.bat
:: batch wrapper script to collect relevant event log entries from multiple print servers and then process these logs with ProcessPrinterLogs.vbs
for %%S in (Server1, Server2, Server3) do (
Set print_server=%%S
CALL :s_get_logs
)
GOTO eof
:s_get_logs
set MainDir=d:\BETPrinters\%print_server%
Set PrintDir=%MainDir%\printdir
Set LogDir=%MainDir%\logs
:: Delete log files older than 30 days
forfiles /p %LogDir% /d -30 /c "CMD /C del @FILE"
:: Create needed directories
if not exist %PrintDir% md %PrintDir%
if not exist %LogDir% md %LogDir%
:: Set date format
for /f "tokens=1-8 delims=/:. " %%i in ('echo %date%') do Set DateFlat=%%j%%k%%l
:: Set log an backup files
Set LogFile=%print_server%_jobs_%DateFlat%.csv
Set BackFile=PrintJobs_%DateFlat%.csv
:: Dump the printer log
:: Using full path for safety
D:\SystemApps32\ResourceKit\dumpel -s \\%print_server% -l System -e 10 -m Print -d 1 >> %logDir%\%LogFile%
:: Make a backup copy
copy %logDir%\%print_server%_jobs_%DateFlat%.csv %PrintDir%\%BackFile% /y
:: Process the logs
cscript ProcessPrinterLogs.vbs /f:%LogDir% /o:%MainDir%\%print_server%_auditoutput.csv
:eof
Okay, so there it is. Enjoy! Use it in good health and for non nefarious purposes!
Saturday, August 30, 2008
Self Management
I've been having some problems with self management lately. Most people would say I'm having issues with time management, but that's not really it. To me, saying you have a problem with time management means that you cannot manage a schedule. Self management goes way beyond just schedules. It includes not only managing your schedule, but managing what you set off to do, what you say yes to, what you say no to (which I don't do near enough of) and controlling the inputs and influences on these things.
It also has to do with managing - and sticking with - the things that are important to you. What really brought this situation to clarity was to things. First, I haven't done jack for running in the last 2 or 3 weeks. Second, I looked at my boss's schedule.
Running: Yes, I made a commitment to running and yes, it is important to me. Then why haven't I done much in the last few weeks? I've been choosing poorly. True, I had a few days when I wasn't feeling well (thanks allergies), but I've missed a lot of other runs. I've made the choice, conscious or otherwise, to let other less-important things take precedence. See, self management. Unfortunately, I have a period of travel scheduled very quickly here, so I can't just jump back into my training schedule and get back on the horse. I've made the commitment to myself, however, that I will run some before I start traveling, run some during my trip, and get back into a full training schedule as soon as I get back. More on that later, I'm sure.
My boss's schedule: I'm very fortunate that I have a boss who is a straight shooter. We're also fairly decent friends, so that helps, too. The other day I was trying to set up a meeting with him and one other person. Guess who's calendar was the problem. Not his. Not the other guy's. MINE!!! When I asked my boss about it, he said, "You're doing too much, and letting your calendar manage you." Funny, I've never heard that from a supervisor before. He told me straight out to delegate more, focus on fewer things, and go to less meetings. Hmmmmmm. Did I hear that right? Seems to work for him. Maybe he's got a point.
Self analysis. OK, so why do I have these problems? To get right down to it the real issues are that I have so many different interest and I am so used to being an independent player that I do a lousy job of not only delegation but following up on delegation. I'm bad at letting things go, but I'm worse at making sure the things I let go actually got done. Wait, isn't that exactly what a leader/manager is SUPPOSED to do? D'oh!
In light of this realization, I've been doing some more reading, looking for methodologies and systems I can use to improve my self management. At present, I'm plowing my way through the "Complete Idiot's Guide to Managing Your Time" by Jeffrey P. Davidson. Despite the title, this book is not so much about time management. Even though I've read many books about time management as well as taken a couple of courses in it, I'm gaining some new insights from Mr. Davidson's book and hope to implement them soon.
I've also been reading the Zenhabits blog. Of particular interest is the Reclaim your time entry. Nothing shocking or unexpected here, but a nice list of things you should focus on.
Anyway, life lessons abound and I continue my journey of self improvement.
It also has to do with managing - and sticking with - the things that are important to you. What really brought this situation to clarity was to things. First, I haven't done jack for running in the last 2 or 3 weeks. Second, I looked at my boss's schedule.
Running: Yes, I made a commitment to running and yes, it is important to me. Then why haven't I done much in the last few weeks? I've been choosing poorly. True, I had a few days when I wasn't feeling well (thanks allergies), but I've missed a lot of other runs. I've made the choice, conscious or otherwise, to let other less-important things take precedence. See, self management. Unfortunately, I have a period of travel scheduled very quickly here, so I can't just jump back into my training schedule and get back on the horse. I've made the commitment to myself, however, that I will run some before I start traveling, run some during my trip, and get back into a full training schedule as soon as I get back. More on that later, I'm sure.
My boss's schedule: I'm very fortunate that I have a boss who is a straight shooter. We're also fairly decent friends, so that helps, too. The other day I was trying to set up a meeting with him and one other person. Guess who's calendar was the problem. Not his. Not the other guy's. MINE!!! When I asked my boss about it, he said, "You're doing too much, and letting your calendar manage you." Funny, I've never heard that from a supervisor before. He told me straight out to delegate more, focus on fewer things, and go to less meetings. Hmmmmmm. Did I hear that right? Seems to work for him. Maybe he's got a point.
Self analysis. OK, so why do I have these problems? To get right down to it the real issues are that I have so many different interest and I am so used to being an independent player that I do a lousy job of not only delegation but following up on delegation. I'm bad at letting things go, but I'm worse at making sure the things I let go actually got done. Wait, isn't that exactly what a leader/manager is SUPPOSED to do? D'oh!
In light of this realization, I've been doing some more reading, looking for methodologies and systems I can use to improve my self management. At present, I'm plowing my way through the "Complete Idiot's Guide to Managing Your Time" by Jeffrey P. Davidson. Despite the title, this book is not so much about time management. Even though I've read many books about time management as well as taken a couple of courses in it, I'm gaining some new insights from Mr. Davidson's book and hope to implement them soon.
I've also been reading the Zenhabits blog. Of particular interest is the Reclaim your time entry. Nothing shocking or unexpected here, but a nice list of things you should focus on.
Anyway, life lessons abound and I continue my journey of self improvement.
Labels:
self management,
time management
Thursday, August 21, 2008
Rant Antidote
So my last blog was odd, weird and pretty much unintelligible. My friend Rob even told me, "Yeah, I read your blog. I didn't get it, but I read it." See, that's what happens when my brain is clouded.
So today was another less-than-enjoyable day. Too many hours in the office, too many stressors, too many disappointments and too many frustrations. However, I'm in a pretty decent mood now. How'd I accomplish that?
I came home and ran 2 miles.
When I started this whole running thing, the original goal was to reduce some of my stress, so I guess I shouldn't be surprised. I'm just kinda surprised at just how well it worked tonight. Hopefully that's a good sign.
So far I've run 5.25 miles this week. Doesn't seem like that far compared to more experienced runners, but I'm proud of it. Tomorrow is a rest day, and then I'm scheduled for 2.5 miles on Saturday. That'll be a total of 7.75 miles for the week. If things go well on Saturday, I may just push an extra .25 miles just to round out my mileage for the week.
Onward....
So today was another less-than-enjoyable day. Too many hours in the office, too many stressors, too many disappointments and too many frustrations. However, I'm in a pretty decent mood now. How'd I accomplish that?
I came home and ran 2 miles.
When I started this whole running thing, the original goal was to reduce some of my stress, so I guess I shouldn't be surprised. I'm just kinda surprised at just how well it worked tonight. Hopefully that's a good sign.
So far I've run 5.25 miles this week. Doesn't seem like that far compared to more experienced runners, but I'm proud of it. Tomorrow is a rest day, and then I'm scheduled for 2.5 miles on Saturday. That'll be a total of 7.75 miles for the week. If things go well on Saturday, I may just push an extra .25 miles just to round out my mileage for the week.
Onward....
Monday, August 18, 2008
Rant
Ever have one of those days where you just want to scream? No single particular reason, just a culmination of everything. Nothing seems to go right. Everybody is on your nerves. The world seems to hate you and you hate it right back.
Yeah?
I had one of those today.
I came home and really just wanted to be left the hell alone, but I couldn't even get that done. I decided to work on my truck, 'cause people will usually leave me alone when I'm doing that. Unfortunately I quickly realized that I would need someone to help me if I was gonna finish installing my new tonneau cover. Rats! I'll have to wait another day to finish that job.
Then I realized I needed to go to the grocery. This is a chore that I really don't relish even on my best days. Too many people!!! Luckily, tonight was a slow night at the store. I was able to find everything I was looking for on the first shot, so I was able to get in and out fairly quickly. Score one for the home team.
The drive home was another story. What's up with people walking their toddlers down the middle of the street? Hello. Anybody home?
Arggggggggggggggggggggggggggg!!!!!
OK, rant dismissed.
Yeah?
I had one of those today.
I came home and really just wanted to be left the hell alone, but I couldn't even get that done. I decided to work on my truck, 'cause people will usually leave me alone when I'm doing that. Unfortunately I quickly realized that I would need someone to help me if I was gonna finish installing my new tonneau cover. Rats! I'll have to wait another day to finish that job.
Then I realized I needed to go to the grocery. This is a chore that I really don't relish even on my best days. Too many people!!! Luckily, tonight was a slow night at the store. I was able to find everything I was looking for on the first shot, so I was able to get in and out fairly quickly. Score one for the home team.
The drive home was another story. What's up with people walking their toddlers down the middle of the street? Hello. Anybody home?
Arggggggggggggggggggggggggggg!!!!!
OK, rant dismissed.
Subscribe to:
Posts (Atom)
