Category Archives: Scripting

PowerShell: Cancel all print jobs

Here’s a quick PowerShell script I put together to delete all print jobs from our Windows Server 2008 R2 print server. It’s run overnight as a scheduled task. We do this because sometimes our print accounting software doesn’t clear out … Continue reading

Posted in PowerShell, Scripting, SysAdmin | Tagged , | 2 Comments

Use the current date in a batch file

I’d done this before, but couldn’t remember how to do it. I found this useful article on support.microsoft.com If you want to grab just the date digits section of today’s date, do the following (echoed in this example) echo %date:~-10,10% … Continue reading

Posted in Scripting, SysAdmin, Windows | Leave a comment

Self-sign your Powershell scripts

Creating my first Powershell script, I came up against code execution issues. Rather than take the easy (sketchy) way out and simply enable execution of unsigned code, I went and figured out how to sign my scripts using my internal … Continue reading

Posted in Scripting, SysAdmin | Leave a comment

VBScript – Check if current user is a member of a certain group

I found some code to do this out on the net the other day. I’ve modified it a little, and added the part that checks environment variables. Note: 11th October 2010 – Since this post is so popular, I’ve cleaned … Continue reading

Posted in Scripting, SysAdmin, Windows | 8 Comments

Windows XP Print-Mapping Automation

Found a useful feature in Windows XP the other week when stuffing around with print-mapping scripts. Instead of using the old con2prt feature to connect to printers, you can use Windows’ inbuilt printing APIs to map printers, add new drivers … Continue reading

Posted in Scripting, Windows | 3 Comments