Scripts and Code
Identifying .Net Versions (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 01 February 2016 09:32
- Written by Christian Dunn
As various versions of Windows include different versions of the .Net Framework and users can install additional versions through many channels it can be hard to determine exactly which versions of which frameworks are installed. This simple VBscript reports on the currently installed versions and service packs. Simply download the file and run or copy the code below to a .vbs file and save and then double click to run.
Importing Photos to PowerPoint (VBA/PowerPoint)
- Details
- Category: Scripts and Code
- Published on Monday, 27 April 2015 23:48
- Written by Christian Dunn
Creating a PowerPoint presentation from a large amount of photos can be very time consuming. Office 2007 and later include a Photo Album feature to assist with importing photos in bulk but this still requires some manual selection of images and can be awkward to use.
The attached macro enabled powerpoint presentation is a demonstration of how VBA can be used to automate this process. This sample includes functions to import all JPG,PNG and GIF images in the folder of the presentation and additional functions and forms to display a progress bar indicating progress for large volumes of images.
The code included in this presentation can be run as a macro or run as part of the presentation. Details are included on the slideshow. This presentation will work in Office 2007 and later.
Importing Calendar Items to Outlook (VBA/Excel)
- Details
- Category: Scripts and Code
- Published on Thursday, 09 April 2015 23:52
- Written by Christian Dunn
Microsoft Outlook includes an import/export feature that can be used to create calendar items from a spreadsheet. This method however only works on your primary mailbox.
If you have direct access to your shared mailboxes or exchange server there are other solutions but as a user this makes it difficult to automatically create calendar items in a shared mailbox. Looking for a solution I discovered an easy way to create a VBA macro that could be used to select and create calendar items in any of my mailboxes. Simply populate this spreadsheet and run the import and you can watch as calendar items are created and meeting requests automatically sent.
Yo API (Asp)
- Details
- Category: Scripts and Code
- Published on Sunday, 11 January 2015 00:11
- Written by Christian Dunn
Yo is a simple application for iOS, Windows Phone and Android that allows you to send a single message, "Yo", to specified users.
Yo has an API designed to allow you to send a notification to users when required.
SendYo is a notification program I have written for Yo to allow it to be used as a Windows notification system.
You can take advantage of the Yo API and related web functionality to use Yo as a notification system. The following ASP pages I have written extend the functionality of Yo and SendYo to provide additional features.
Finding Long Running Queries (SQL)
- Details
- Category: Scripts and Code
- Published on Monday, 01 December 2014 23:44
- Written by Christian Dunn
A common challenge for database administrators is identifying queries from an application or user that are impacting the performance of a SQL server. These are usually long running queries that can either slow down performance of the SQL server or cause the TEMPDB (the temporary database used by SQL for processing) to grow in size dramatically. Either of these is likely to have an impact on the user experience. These scripts will help you identify these queries.
These scripts have been tested on SQL 2008 R2 and SQL 2012.
Issue Recorder (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 27 January 2014 22:11
- Written by Christian Dunn
One of the biggest challenges for IT Support engineer's is understanding the issues that end users are experiencing. Without being able to see their actions getting them to provide the steps they take to perform a function prior to an error occurring is a constant challenge. Fortunately Microsoft have added a fantastic tool called the Problem Steps Recorder to Windows 7 and 8 that solves this challenging by capturing every step that a user takes when replicating an issue.
While this tool is fantastic it is not accessible in the start menu and does not provide a useful wizard to step end users through the process they need to follow to capture then forward their issue steps to your help desk. This script resolves this issue by providing a wizard to capture the steps of a problem and email them to the relevant people in a few simple steps and without any extra programs or plugins required.
Make Windows Talk (VBScript)
- Details
- Category: Scripts and Code
- Published on Saturday, 23 November 2013 23:22
- Written by Christian Dunn
VBScript allows you to perform many powerful windows functions. There are also many hidden features you are not aware of. If you have ever enabled the accessibility options you may have found an option for Windows to read pages out to you or tell you what you are clicking on. This feature can also be accessed via vbscript to make great scripts that talk to users.
The following is a simple example. Copy these three lines and paste them into a text file called "Speak.vbs". Run this file to hear your computer talk to you.
strText = "Hi, this is your computer speaking"
Set objVoice = CreateObject("SAPI.SpVoice")
objVoice.Speak strText
There are also many great nefarious uses for this script including making a windows login script that speaks to users when they boot their computer or placing a hidden task on a friend's computer to pipe up at regular intervals and say hi. Enjoy.
Printers and Jobs Report (VBScript)
- Details
- Category: Scripts and Code
- Published on Sunday, 10 November 2013 22:55
- Written by Christian Dunn
Monitoring printers and print jobs in Windows isn't always easy especially if your printer queues are scattered across multiple servers. If you want near real time monitoring of errors or problems with your printers or print jobs then my application, Print Stalker, can be installed on each server to notify you directly when these issues occur. There are many instances however where you may be required to report on the status of all printers on the network or identify any print jobs that may be causing concern on individual printers. This script produces a detailed color coded report with that information.
This script includes the following features:
- Command line progress notifications to identify when/if problems occur
- Tables of printer status and details and print jobs status and details for all servers specified
- Color coding of printer and job status for easy identification
- Configurable output location
- HTML report generation with options to save to file or open in browser automatically
- CDO email report sending option with ability to include inline header logo image (if file exists)
- Configurable Options section marked in script to assist beginners in making modifications
- WMI queries on Win32_Printer and Win32_Printers
Send email using CDO (VBScript)
- Details
- Category: Scripts and Code
- Published on Tuesday, 30 April 2013 00:40
- Written by Christian Dunn
If you have servers to monitor and require automated email notifications then you need a VBScript that can be scheduled and run automatically. This script allows you to take any HTML file and send it as the content of an email and include another file as an attachment. I have used this in conjunction with scripts that generate server storage space using WMI so I can monitor disk usage. This email can constitute a daily or weekly report simplifying your management and monitoring. This script uses CDO to send mail and can be configured with or without authentication.
To trigger this script from a scheduled task it is recommended to use a command./batch file which is included with 32 bit and 64 bit example. Simply comment out the unrequired section depending on your environment. This script is designed to be run from your C drive but can be easily modified. Remember to configure your email settings before use. I have highlighted the sections you need to modify.
Retrieve DNS Records (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 21 January 2013 01:00
- Written by Christian Dunn
As a network administrator you are often working with machines across different domains or subnets in the business and it can be hard to see and access these computers by name. Instead of remembering a long list of fully qualified domain names this script finds your primary DNS server and enumerates all of the PTR records and exports them to an easy to read spreadsheet. For DNS servers with multiple domains this will retrieve all records. If possible it also retrieves the time this information was updated so you can identify computers that have not 'checked in' to the network recently or stale DNS records. This script may require you to have permission to read WMI from the DNS server so is best run by a network administrator on a server however the script can be easily modified so the spreadsheet is generated in a location shared to users.
Network Deployment Tool (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 20 August 2012 00:00
- Written by Christian Dunn
The Network Deployment Tool demonstrates how to use PSEXEC, NETSCAN and VBScript to deploy any application, command or script to all computers in the current domain and subnet. This application is ready to use as is and will prompt for users to configure the appropriate target files for deployment.
When you run the application a HTML Deployment Summary window appears to provide you with details on the progress of your deployment and asks for your confirmation.
On each targeted machine your application files are deployed and then executed as you have configured in a batch file included with the deployed files.
This script is designed to be run on a machine in the same subnet as target computers and with administrative rights and has been tested on Windows 7, Windows 8 and Server 2008 although it should also work on XP SP2 and 2003 SP2 or later machines. A sample deployment which simply pops up a message on each computer is included but I have also included additional code for configuring an email to confirm a test deployment without user intervention.
You can print or email the HTML summary window when complete (some code changes required to email to custom address) and it is also saved to file automatically.
Godmode (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 30 April 2012 13:34
- Written by Christian Dunn
This script creates all of the GodMode shortcuts available in Windows 7 and 8.
DNSChanger Malware Infection Test Script (VBScript)
- Details
- Category: Scripts and Code
- Published on Wednesday, 28 March 2012 15:00
- Written by Christian Dunn
This script checks the DNS settings of your computer to identify whether you are potentially infected with DNSChanger. DNSChanger is a serious malware infection that can change your DNS servers. A temporary global fix has been put in place until July 9 2012. At this time this fix will no longer work and infected machines may not be able to access the internet. For more information from the DNS Changer Working Group see http://dcwg.org/index.html
Read more: DNSChanger Malware Infection Test Script (VBScript)
Detect and Eject CD Drives (VBScript)
- Details
- Category: Scripts and Code
- Published on Tuesday, 08 November 2011 12:00
- Written by Christian Dunn
This script detects, identifies then ejects CD ROM drives on a Windows machine.
Update Windows Owner and Organization (VBScript)
- Details
- Category: Scripts and Code
- Published on Tuesday, 08 November 2011 09:35
- Written by Christian Dunn
This script updates the Windows Owner and Organisation information on Windows Vista or later.
After completion it will show the Windows registration information.
Scan and Defrag (VBScript)
- Details
- Category: Scripts and Code
- Published on Tuesday, 08 November 2011 09:02
- Written by Christian Dunn
This script performs a chkdisk scan and a defrag of the current machine.
Enumerate Printers (VBScript)
- Details
- Category: Scripts and Code
- Published on Tuesday, 08 November 2011 09:00
- Written by Christian Dunn
This script displays information about each installed printer.
List IP Addresses (VBScript)
- Details
- Category: Scripts and Code
- Published on Tuesday, 08 November 2011 08:54
- Written by Christian Dunn
This script displays a list of all IP addresses assigned to the current machine.
Retrieve Drive Information (VBScript)
- Details
- Category: Scripts and Code
- Published on Tuesday, 08 November 2011 08:50
- Written by Christian Dunn
This script uses WMI to retrieve information about the current disk drive.
Last Reboot (VBScript)
- Details
- Category: Scripts and Code
- Published on Tuesday, 08 November 2011 03:14
- Written by Christian Dunn
This script retrieves the last reboot time from the operating system and converts it into Hours, Minutes and Seconds.
Simply copy and paste the code into notepad and save as uptime.vbs. Double click the file to run.
Windows Version Number (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 07 November 2011 16:17
- Written by Christian Dunn
Need your Windows Version Number?
The following script returns a dialog box indicating the version number of the operating system.
Mailbox Sizes Exchange 2003 (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 07 November 2011 15:26
- Written by Christian Dunn
This script produces a summary of mailbox sizes on an Exchange 2003 server.
This includes; Server Name,Storage Group,User Display Name,Mailbox Size,Total Items,Deleted Items Size.
Monitoring printers and services (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 07 November 2011 15:19
- Written by Christian Dunn
The following script logs printer and service activity on a server.
This script is designed to identify the cause of printer issues by recording changes in the spool service or print job classes.
Adding or Removing Printers (VBScript)
- Details
- Category: Scripts and Code
- Published on Monday, 07 November 2011 05:15
- Written by Christian Dunn
Adding or Removing printers using VBScript.
The following script can be triggered by adding the path to the vbs file to the network logon script.
Printers can be added or removed when this script is run.
Move your iTunes Library Completely (VBScript)
- Details
- Category: Scripts and Code
- Published on Saturday, 22 October 2011 01:18
- Written by Christian Dunn
There are many reasons you may wish to move your iTunes library. It may be taking up more space than you have on your C drive, you may wish to move it to another computer, or in an office environment you might accidentally be storing your music on the servers. This script is very simple to configure and steps the user through the process.
The full code is shown below. VBScript works on all versions of Windows.