<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>James&#039; Tools and Tricks</title>
	<atom:link href="http://jrudd.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://jrudd.org</link>
	<description>Tools, Tips and Hints for managing a network.</description>
	<lastBuildDate>Sun, 15 Aug 2010 23:11:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Papercut</title>
		<link>http://jrudd.org/2010/08/papercut/</link>
		<comments>http://jrudd.org/2010/08/papercut/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 23:11:23 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Novell]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Papercut]]></category>
		<category><![CDATA[Photocopier]]></category>
		<category><![CDATA[photocopiers]]></category>
		<category><![CDATA[Printer]]></category>
		<category><![CDATA[printer usage]]></category>
		<category><![CDATA[Printing]]></category>
		<category><![CDATA[student laptop]]></category>
		<category><![CDATA[Windows 2008]]></category>
		<category><![CDATA[Windows 2008 R2]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=232</guid>
		<description><![CDATA[I have received a few questions asking about Papercut so here are some of the details about it and what we use it for. Papercut can run on a Windows Server (2003, 2008 or 2008 R2) using windows print queues or a Novell Linux OES server with iPrint (CUPS &#38; SAMBA), it is written in <a href='http://jrudd.org/2010/08/papercut/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://jrudd.org/wp-content/uploads/2010/08/Papercut1.png" rel="lightbox[232]"><img class="alignleft size-medium wp-image-242" title="Papercut Accounts" src="http://jrudd.org/wp-content/uploads/2010/08/Papercut1-294x300.png" alt="" width="294" height="300" /></a>I have received a few questions asking about <a href="http://www.papercut.com">Papercut</a> so here are some of the details about it and what we use it for.</p>
<p>Papercut can run on a Windows Server (2003, 2008 or 2008 R2) using windows print queues or a Novell Linux OES server with <a href="http://www.papercut.com/download/ng/#novell">iPrint</a> (CUPS &amp; SAMBA), it is written in Java with some wrappers for the OS in use.</p>
<p>We originally ran it on a Server 2003 R2 (x86) but have recently updated to a Windows 2008 R2 (x64)print server. The main reason for the upgrade was to provide up to date drivers for Windows 7 32 &amp; 64bit. We also run the <a href="http://www.papercut-mf.com">Papercut MF</a> version which costs A LOT more, but allows you to use it with external devices, such as photocopiers.</p>
<p>Papercut has some really useful features, <a href="http://www.papercut.com/tour/balance-recharge/top-up-cards/">Card recharge</a> allows you to generate top up cards and print them out yourself. Then you just cut them up and given them to the office (or canteen) to sell to the students. Makes recharging much easier and no need for office staff to login to an admin console to top up accounts.</p>
<p>We recently had a student laptop roll-out (NSW DER), these laptops are not on our domain so needed an alternative way to print. Papercut has a feature called <a href="http://www.papercut.com/tour/web-print/">WebPrint </a>which allows students to upload MS office or PDF files to a website and have them printed to the chosen printer. You need to run software for it on a windows pc (server or client) which automatically opens the document and prints it to the chosen printer. As our Print server is running Windows and is a virtual machine we just configured it to auto-login as a limited user we created and installed Office, and Acrobat.</p>
<p>We use the <a href="http://www.papercut.com/tour/reporting-in-detail/">reports</a> function for auditing staff accounts and charging printer usage back to faculties. Staff are automatically added to different charge accounts based on their AD group membership.</p>
<p>We have just started using Advanced Scripting to charge staff different prices than students on shared copiers and printers.<br />
The following script is what we use, as it is based on how faculties are invoiced at the end of each term. It is based on the Papercut recipe &#8220;Discount for staff&#8221; with a few changes.</p>
<pre class="brush: jscript; collapse: true; light: false; toolbar: true;">
/*
* Change Pricing for staff
*
* Staff are charged based on cost to school.
*
*/
function printJobHook(inputs, actions) {

var DISCOUNT_GROUP   = &quot;Staff-All&quot;;
var COST_COLOUR  = 0.07; // Click Rate of Colour
var COST_BW  = 0.02;  // Click Rate of B/W
var COST_A4  = 0.01;  // Price per page of A4
var COST_A3  = 0.03;  // Price per page of A3

/*
* This print hook will need access to all job details
* so return if full job analysis is not yet complete.
* The only job details that are available before analysis
* are metadata such as username, printer name, and date.
*
* See reference documentation for full explanation.
*/

if (!inputs.job.isAnalysisComplete) {
	// No job details yet so return.
	return;
}

if (inputs.user.isInGroup(DISCOUNT_GROUP)) {
	// Debug messages are written to [install-path]/server/logs/server.log
	actions.log.debug(&quot;Cost before discount: &quot; + inputs.job.cost);

	// Initial 0
	var newCost = 0;

	// Includes Duplex
	if (inputs.job.paperSizeName == &quot;A4&quot;) {
		newCost = inputs.job.totalSheets * COST_A4;
	}
	else {
		newCost = inputs.job.totalSheets * COST_A3 ;
	}

	newCost += inputs.job.totalGrayscalePages * COST_BW;
	newCost += inputs.job.totalColorPages * COST_COLOUR;

	 actions.job.setCost(newCost);

	actions.log.debug(&quot;Staff Pricing on &quot; + inputs.job.printerName + &quot; For &quot; + inputs.job.totalSheets +
		&quot; sheets had &quot; + inputs.job.totalGrayscalePages + &quot; B/W &amp; &quot; +
		inputs.job.totalColorPages + &quot; Colour, Cost after discount: &quot; + newCost);

	// Record that as discount was applied in the job comment.
	actions.job.addComment(&quot;Staff Pricing applied. Had &quot; + inputs.job.totalGrayscalePages + &quot; B/W &amp; &quot; +
	inputs.job.totalColorPages + &quot; Colour&quot;);
	}
}
</pre>
<p>Other useful features:</p>
<ul>
<li>Students and staff see a summary of how many pages they are going to print, which helps reduce accidental printing of entire chapters of text instead of just a few pages.</li>
<li>Logs and statistics show which printers are getting used, how much is getting printed, and who printed the document but didn&#8217;t collect it.</li>
<li>Great support. I have contacted them over a number of issues and they have always gotten back quickly with good ideas, or have added features in later versions.</li>
</ul>
<p>Downsides:</p>
<ul>
<li>Although the price for education version of <a href="http://www.papercut.com/pricing/education/">Papercut NG </a>is not too bad, to get the MF version which supports copiers it costs around twice as much. Also you then need cost recovery devices for the copiers ~AUD$1,800 each, and there are annual support and maintenance costs ~AUD$1,000/year.</li>
</ul>
<p>If you want to get an idea of how much printing your staff and students or just want to keep a record of who is printing what (like you could do easily with iPrint)  try the free <a href="http://www.papercut.com/products/free_software/print_logger/">Papercut Print Logger</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2010/08/papercut/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pre-populate Users names and email address in Office and Acrobat</title>
		<link>http://jrudd.org/2010/07/pre-populate-users-names-and-email-address-in-office-and-acrobat/</link>
		<comments>http://jrudd.org/2010/07/pre-populate-users-names-and-email-address-in-office-and-acrobat/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 07:01:58 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Adobe Acrobat]]></category>
		<category><![CDATA[adobe acrobat reader]]></category>
		<category><![CDATA[Microsoft Office]]></category>
		<category><![CDATA[simple vbscript]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[Windows Registry]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=211</guid>
		<description><![CDATA[Often you would like some personal information filled in for the user before they start the application. E.g. Why have Office or Acrobat ask for the users name when it is already stored in active directory? Here are some simple VBScripts that can be added to a log on script or similar to pre-fill these <a href='http://jrudd.org/2010/07/pre-populate-users-names-and-email-address-in-office-and-acrobat/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Often you would like some personal information filled in for the user before they start the application. E.g. Why have Office or Acrobat ask for the users name when it is already stored in active directory?</p>
<p>Here are some simple VBScripts that can be added to a log on script or similar to pre-fill these for the user. Once you know the registry location where the identity information is  stored it is quite easy to fill those values as part of a login script.</p>
<h3>Microsoft Office</h3>
<pre class="brush: vb;">' Original MS Office script written by David Isaacs
Set oShell = CreateObject(&quot;WScript.Shell&quot;)

On Error Resume Next

strUsername = oShell.ExpandEnvironmentStrings(&quot;%USERNAME%&quot;)
strUserdomain = oShell.ExpandEnvironmentStrings(&quot;%USERDOMAIN%&quot;)

Set oUser = GetObject(&quot;WinNT://&quot; &amp; strUserdomain &amp; &quot;/&quot; &amp; strUsername &amp; &quot;,user&quot;)

oShell.RegWrite &quot;HKCU\Software\Microsoft\Office\Common\UserInfo\UserInitials&quot;, strUsername
oShell.RegWrite &quot;HKCU\Software\Microsoft\Office\Common\UserInfo\UserName&quot;, oUser.Fullname</pre>
<h3>Adobe Acrobat Pro and Reader</h3>
<p>This will set the full name, office, email address and your company for multiple versions of Acrobat and Acrobat reader. You can add even more versions by adding extra lines to the array.</p>
<p>Also if you modified Acrobat to install with Acrobat.com disabled, but  now wish to enable it this will enable it. We originally had it disabled, but found email and network form  submission did not work properly until it was enabled.</p>
<p>The method for accessing the AD User object was posted by Mike Walker in this <a href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/d2d9bf23-e27f-4f30-9199-42833d6919a4">thread</a>.</p>
<pre class="brush: vb;">' Configure Adobe Acrobat default settings
' Written by James Rudd
Set oShell = CreateObject(&quot;WScript.Shell&quot;)
Set oFso = CreateObject(&quot;Scripting.FileSystemObject&quot;)

' Set the different registry paths for Acrobat
Dim regPaths(2)
regPaths(0) = &quot;HKEY_CURRENT_USER\Software\Adobe\Adobe Acrobat\9.0\&quot;  'For Acrobat Pro 9
regPaths(1) = &quot;HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\&quot;  'For Acrobat Reader 9
regPaths(2) = &quot;HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\8.0\&quot;  'Same for Acrobat Reader 8

On Error Resume Next

' Create the ADSystem Information Object
Set objADSystemInfo = CreateObject(&quot;ADSystemInfo&quot;)
' Get the current information into a new Object
Set objUser = GetObject(&quot;LDAP://&quot; &amp; objADSystemInfo.UserName)

For Each regPath In regPaths
 'Enable Acrobat.com by deleting key that contains disabling entries.
 oShell.regdelete regPath &amp; &quot;Workflows\&quot;

 'Set Acrobat Identity Info
 oShell.RegWrite regPath &amp; &quot;Identity\tEMail&quot;, objUser.mail, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tName&quot;, objUser.givenName &amp; &quot; &quot; &amp; objUser.sn, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tFirstName&quot;, objUser.givenName, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tLastName&quot;, objUser.sn, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tCorporation&quot;, &quot;Your Company Name&quot;, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tDepartment&quot;, objUser.physicalDeliveryOfficeName, &quot;REG_SZ&quot;

 'Set Default Acrobat Collaboration details
 oShell.RegWrite regPath &amp; &quot;ShareIdentity\tEMail&quot;, objUser.mail, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;ShareIdentity\tFullName&quot;, objUser.givenName &amp; &quot; &quot; &amp; objUser.sn, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;ShareIdentity\tCorporation&quot;, &quot;Your Company Name&quot;, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;ShareIdentity\tDepartment&quot;, objUser.physicalDeliveryOfficeName, &quot;REG_SZ&quot;
Next
</pre>
<h3>Combined</h3>
<p>The following script combines both Office and Acrobat data in to one, and reuses the same data objects rather than use two different connection techniques.</p>
<pre class="brush: vb;">
' Configure Adobe Acrobat and MS Office user settings
' Written by James Rudd

Const strCompanyName = &quot;Your School Name&quot;

Set oShell = CreateObject(&quot;WScript.Shell&quot;)
Set oFso = CreateObject(&quot;Scripting.FileSystemObject&quot;)

' Create the ADSystem Information Object
Set objADSystemInfo = CreateObject(&quot;ADSystemInfo&quot;)
' Get the current information into a new Object
Set objUser = GetObject(&quot;LDAP://&quot; &amp; objADSystemInfo.UserName)

On Error Resume Next

'Office Details
oShell.RegWrite &quot;HKCU\Software\Microsoft\Office\Common\UserInfo\UserInitials&quot;, objUser.sAMAccountName, &quot;REG_SZ&quot;
oShell.RegWrite &quot;HKCU\Software\Microsoft\Office\Common\UserInfo\UserName&quot;, objUser.givenName &amp; &quot; &quot; &amp; objUser.sn, &quot;REG_SZ&quot;
' If set by installer Company Name is overidden on load.
oShell.RegWrite &quot;HKCU\Software\Microsoft\Office\Common\UserInfo\Company&quot;, strCompanyName, &quot;REG_SZ&quot;

' Set the different registry paths for Acrobat
Dim regPaths(2)
regPaths(0) = &quot;HKEY_CURRENT_USER\Software\Adobe\Adobe Acrobat\9.0\&quot;  'For Acrobat Pro 9
regPaths(1) = &quot;HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\&quot;  'For Acrobat Reader 9
regPaths(2) = &quot;HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\8.0\&quot;  'Same for Acrobat Reader 8

For Each regPath In regPaths
 'Enable Acrobat.com by deleting key that contains disabling entries.
 oShell.regdelete regPath &amp; &quot;Workflows\&quot;

 'Set Acrobat Identity Info
 oShell.RegWrite regPath &amp; &quot;Identity\tEMail&quot;, objUser.mail, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tName&quot;, objUser.givenName &amp; &quot; &quot; &amp; objUser.sn, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tFirstName&quot;, objUser.givenName, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tLastName&quot;, objUser.sn, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tCorporation&quot;, &quot;Your Company Name&quot;, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;Identity\tDepartment&quot;, objUser.physicalDeliveryOfficeName, &quot;REG_SZ&quot;

 'Set Default Acrobat Collaboration details
 oShell.RegWrite regPath &amp; &quot;ShareIdentity\tEMail&quot;, objUser.mail, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;ShareIdentity\tFullName&quot;, objUser.givenName &amp; &quot; &quot; &amp; objUser.sn, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;ShareIdentity\tCorporation&quot;, strCompanyName, &quot;REG_SZ&quot;
 oShell.RegWrite regPath &amp; &quot;ShareIdentity\tDepartment&quot;, objUser.physicalDeliveryOfficeName, &quot;REG_SZ&quot;
Next
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2010/07/pre-populate-users-names-and-email-address-in-office-and-acrobat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using BackupPC with DiskShadow to backup open files</title>
		<link>http://jrudd.org/2010/07/using-backuppc-with-diskshadow-to-backup-open-files/</link>
		<comments>http://jrudd.org/2010/07/using-backuppc-with-diskshadow-to-backup-open-files/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:59:48 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[DiskShadow]]></category>
		<category><![CDATA[noacl]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[server 2008 R2]]></category>
		<category><![CDATA[snapshots]]></category>
		<category><![CDATA[Task Scheduler]]></category>
		<category><![CDATA[VShadow]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=151</guid>
		<description><![CDATA[This post is to assist in the setup of a BackupPC system able to backup in use files by using MS volume snapshots. It also has the benefit of only having the RSync daemon running during the backup which increases security.]]></description>
			<content:encoded><![CDATA[
<h1>Introduction</h1>
<p>This post is to assist in the setup of a BackupPC system able to  backup in use files by using MS volume snapshots. It also has the  benefit of only having the RSync daemon running during the backup which  increases security.</p>
<p>This method is based on some other posts I  have seen using <a href="http://www.goodjobsucking.com/?p=62">VShadow</a>, <a href="http://www.goodjobsucking.com/?p=62"><em>Backing Up Open Files on Windows with Rsync</em></a>, and some  suggestions on <a href="http://www.goodjobsucking.com/?p=62&amp;cpage=2#comment-3159">DiskShadow</a> but goes further in using RSync as a system service giving full access  to files, and removing the need to use winexe.</p>
<h2>General Outline</h2>
<ol>
<li>Create a new user <em><strong>backuppc </strong></em>(try to match case of the user on Linux). Very limited rights</li>
<li>Install Cygwin with RSync, OpenSSH and configure them</li>
<li>Create a scheduled task to run as SYSTEM when triggered by a certain event</li>
<li>Set BackupPC server for passwordless login to host and modify Pre/Post Dump Cmds</li>
</ol>

<h1>Overview</h1>
<p>In Windows 7 and Server 2008 R2 elevation is required to create snapshots. As a remote SSH connection cannot bypass UAC a way is needed to create the snapshot, bypassing the elevation prompt. I also wished to run the Rsync Daemon as SYSTEM user so it has rights to view all files.</p>
<p>To do this I moved all the elevated tasks into a Task Scheduler item that is set to run as SYSTEM, and is triggered by an Event log event.</p>
<ol>
<li>BackupPC performs a password-less key SSH logon to client</li>
<li>It runs a script which creates an event log entry and then waits for RSync to start before returning to BackupPC and starting the backup.</li>
<li>Task scheduler is triggered by <a href="http://support.microsoft.com/kb/315410">Event Log</a> and starts DiskShadow as SYSTEM.</li>
<li>Disk shadow creates a shadow of any chosen volumes, mounts them and then starts RSync.<br />
It then waits for a file to be created by BackupPC at the end of the backup telling it to stop RSync and delete the snaphots.</li>
</ol>
<h3>Flow and triggers</h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="205" valign="top"><strong>BackupPC Server</strong></td>
<td colspan="2" width="411" valign="top"><strong>Host PC</strong></td>
</tr>
<tr>
<td width="205" valign="top"><strong>backuppc User</strong></td>
<td width="205" valign="top"><strong>backuppc User</strong></td>
<td width="205" valign="top"><strong>SYSTEM</strong></td>
</tr>
<tr>
<td style="text-align: center;" colspan="3" width="411" valign="top"><strong>Start Backup</strong></td>
</tr>
<tr>
<td width="205" valign="top">SSH to Host PC</td>
<td width="205" valign="top"></td>
<td width="205" valign="top"></td>
</tr>
<tr>
<td width="205" valign="top"></td>
<td width="205" valign="top">Log Event</td>
<td width="205" valign="top">Diskshadow: Snaphsot</td>
</tr>
<tr>
<td width="205" valign="top"></td>
<td width="205" valign="top"></td>
<td width="205" valign="top">Start Rsync</td>
</tr>
<tr>
<td width="205" valign="top"></td>
<td width="205" valign="top">Close and return</td>
<td width="205" valign="top"></td>
</tr>
<tr>
<td width="205" valign="top">Begin Backup</td>
<td width="205" valign="top"></td>
<td width="205" valign="top"></td>
</tr>
<tr>
<td style="text-align: center;" colspan="3" width="411" valign="top"><strong>Finish Backup</strong></td>
</tr>
<tr>
<td width="205" valign="top">SSH to Host PC</td>
<td width="205" valign="top"></td>
<td width="205" valign="top"></td>
</tr>
<tr>
<td width="205" valign="top"></td>
<td width="205" valign="top">Create a Wake.up file</td>
<td width="205" valign="top"></td>
</tr>
<tr>
<td width="205" valign="top"></td>
<td width="205" valign="top"></td>
<td width="205" valign="top">Stop Rsync</td>
</tr>
<tr>
<td width="205" valign="top"></td>
<td width="205" valign="top"></td>
<td width="205" valign="top">Delete Snaphost</td>
</tr>
</tbody>
</table>
<h1>Host PC</h1>
<p>Create a new user, <em><strong>backuppc</strong></em>, you can limit this account further in Security policy after everything is configured.</p>
<p>Create a BackupPC folder and add the following scripts to it. These are also available in a <a href="http://jrudd.org//download/general/BackupPC-Config.zip">zip file</a>. Note: There is a file embedded within this post, please visit this post to download the file. You will need to modify paths depending on where you create the folder. I used C:\cygwin\BackupPC but a better location may be C:\cygwin\usr\share\BackupPC</p>
<p>Most of these scripts are just modified versions of the ones written for <a href="http://www.goodjobsucking.com/?p=62">VShadow</a>, changed to work with DiskShadow and Task Scheduler.</p>
<p><strong>pre-cmd.vbs</strong></p>
<pre class="brush: vb; collapse: true; light: false; toolbar: true;">' This file starts the commands
' It will start the snapshot process and quite once RSync is running

Const Rsync = &quot;C:\cygwin\var\run\rsyncd.pid&quot;
Const Flag = &quot;C:\cygwin\var\run\wake.up&quot;
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
'
' Pid file shouldn't be there already
' Check /stop service , still there delete
'
If DoesFileExist(Rsync)=0 Then
	fso.DeleteFile(Rsync)
End If
'
' Nor should &quot;wake.up&quot;
'
If DoesFileExist(Flag)=0 Then
   fso.DeleteFile(Flag)
End If

Set objShell = CreateObject(&quot;WScript.Shell&quot;)
' objShell.Exec &quot;C:\BackupPC\backuppc.cmd &gt; &quot; &amp; Log

' This writes event log entry that triggers task scheduler to start system process
' that takes snapshot and starts RSync
objShell.Exec &quot;Logevent.exe -r &quot;&quot;BackupPC&quot;&quot; -e 10 -s S &quot;&quot;Backup Start&quot;&quot; &quot;
Wscript.Echo &quot;Sent BackupPC Event Log Trigger&quot;

'
' Just sleep until the file &quot;rsyncd.pid&quot; appears
'

While DoesFileExist(Rsync)
   wscript.sleep 10000
Wend

' functions

function DoesFileExist(FilePath)
Dim fso
	Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	if not fso.FileExists(FilePath) then
		DoesFileExist = -1
	else
		DoesFileExist = 0
	end if
	Set fso = Nothing

end function</pre>
<p><strong>backuppc.cmd</strong></p>
<pre class="brush: plain; collapse: true; light: false; toolbar: true;">c:
cd C:\cygwin\BackupPC
diskshadow /s DiskShadowScript.txt /l C:\cygwin\var\log\diskshadow.log
del C:\cygwin\var\tmp\*.cab /q
c:cd C:\cygwin\BackupPCdiskshadow /s DiskShadowScript.txt /l C:\cygwin\var\log\diskshadow.log
del C:\cygwin\var\tmp\*.cab /q</pre>
<p><strong>DiskShadowScript.txt</strong></p>
<pre class="brush: plain; collapse: true; light: false; toolbar: true;">#DiskShadow script file

#Make shadows persistent, No writers as data volume

# If backing up C: and any app files (ntds, database, etc) use writers

#SET CONTEXT PERSISTENT NOWRITERS

SET CONTEXT PERSISTENT

#Cab location for process

SET METADATA C:\cygwin\var\tmp\backup.cab

SET VERBOSE ON

BEGIN BACKUP

#Alias volume with alias

ADD VOLUME C: ALIAS SystemData

ADD VOLUME F: ALIAS UserData

#Create Snapshot

CREATE

#Expose the volume and run command file then unexpose

EXPOSE %UserData% B:

EXPOSE %SystemData% T:

EXEC C:\cygwin\BackupPC\Serverbackup.cmd

UNEXPOSE B:

UNEXPOSE T:

END BACKUP

#Delete the shadow copy

DELETE SHADOWS SET %VSS_SHADOW_SET%

#End of script</pre>
<p><strong>Serverbackup.cmd</strong></p>
<pre class="brush: plain; collapse: true; light: false; toolbar: true;">REM Start RSync now that Snapshots are created

net start rsyncd

REM Need to wait until backup completed

cscript &quot;C:\cygwin\BackupPC\sleep.vbs&quot;

Logevent.exe -r &quot;BackupPC&quot; -e 20 -s S &quot;Backup Completed&quot;
</pre>
<p><strong>sleep.vbs</strong></p>
<pre class="brush: vb; collapse: true; light: false; toolbar: true;">Const Rsync = &quot;C:\cygwin\var\run\rsyncd.pid&quot;
Const Flag = &quot;C:\cygwin\var\run\wake.up&quot;
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)

' Just sleep until the file &quot;rsyncd.pid&quot; appears
While DoesFileExist(Rsync)
   wscript.sleep 10000
Wend

' Now sleep until the file &quot;wake.up&quot; appears
While DoesFileExist(Flag)
   wscript.sleep 10000
Wend

fso.DeleteFile(Flag)

' It's time to kill Rsync
'Stop Service
strServiceName = &quot;rsyncd&quot;
Set objWMIService = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2&quot;)
Set colListOfServices = objWMIService.ExecQuery(&quot;Select * from Win32_Service Where Name ='&quot; &amp; strServiceName &amp; &quot;'&quot;)
For Each objService in colListOfServices
    objService.StopService()
	Wscript.Echo &quot;RSyncD Stopped&quot;
Next

' Wait for Rsync to let go
wscript.sleep 5000

' Delete PID file
If DoesFileExist(Rsync)=0 Then
   fso.DeleteFile(Rsync)
End If

' functions
function DoesFileExist(FilePath)
Dim fso
	Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	if not fso.FileExists(FilePath) then
		DoesFileExist = -1
	else
		DoesFileExist = 0
	end if
	Set fso = Nothing

end function
</pre>
<h2>Cygwin</h2>
<p>Install Cygwin and choose to install packages RSync and OpenSSH</p>
<p>Start an elevated Cygwin (Run as an Administrator )</p>
<h4>Config</h4>
<p>Cygwin 1.7 changes the way to ignore NT Security from the <em>nontsec </em>environment to modifying fstab file.</p>
<p>In your prefered editor modify /etc/fstab and uncomment the bottom line and add <em>noacl </em>as below, this tells it to ignore security :</p>
<pre class="brush: plain; light: true;">none /cygdrive cygdrive binary,noacl,posix=0,user 0 0</pre>
<p>Run following to update group and user lists (if on a domain only add the users you want)</p>
<p>[bashlight=1]mkpasswd –l >/etc/passwd<br />
mkgroup –l /etc/group[/bash]</p>
<h3>OpenSSH</h3>
<p>Configure Open SSH using <em>ssh-host-config</em>, create both the accounts it suggests for privilege isolation and running the service (cyg_service &amp; sshd).<br />
This should also automatically add the Firewall Exceptions (SSHD).</p>
<h4>Setting up Keyless</h4>
<p><span style="font-weight: normal;">Login as backuppc user.</span><br />
<span style="font-weight: normal;"> </span><span style="font-weight: normal;">Use </span></p>
<pre class="brush: plain; light: true;">runas /user:backuppc cmd</pre>
<p>Or</p>
<pre class="brush: plain; light: true;">runas /user:domain\backuppc cmd</pre>
<p>Run c:\cygwin\Cygwin.bat to start Cygwin as BackupPC user</p>
<p>You need to add the id_rsa.pub file from the BackupPC user on BackupPC server to C:\cygwin\home\backuppc\.ssh\authorized_keys If you have not already created one follow the instructions below in BackupPC &#8211; SSH section.</p>
<h3>RSync</h3>
<p>To install RSync as a system service use:</p>
<pre class="brush: plain;">C:\cygwin\bin\cygrunsrv.exe -I rsyncd -d &quot;RSync Daemon&quot; -O --type manual -p /bin/rsync.exe -f &quot;Used by BackupPC to remotely access files for backup&quot; -a &quot; --config=/etc/rsyncd.conf --daemon --no-detach&quot;</pre>
<p>Modify the /etc/rsyncd.conf file to reflect what drives you want to backup. It is better to edit this file later after you have modified the DiskShadowScript.txt and changed which drive letter it exposes shadows as.</p>
<p>Add a RSync exception to the firewall.</p>
<p>Open <em>Windows Firewall with Advanced Security</em> and choose Inbound Rules, New Rule, Program,  Next</p>
<p>Browse to C:\cygwin\bin\rsync.exe and then choose your options and name the rule</p>
<p>When finished open the rule, click Scope tab and add a Remote IP, that of the BackupPC server. This restricts RSync to only be accessible from BackupPC. You may also wish to similarly modify SSHD to only allow SSH access from BackupPC server.</p>
<h2>DiskShadow</h2>
<p>If you are backing up a windows Server 2008 or 2008 R2 host you already have DiskShadow installed. However, if you are running Windows 7 or Vista you will need to grab a copy from an equivalent server (x86 or x64). It is located in the System32 directory and you will also need the language file from the en-US folder.</p>
<p>I have <a href="http://jrudd.org//download/utilities/DiskShadow.zip">zipped the files needed</a> for x86 and x64 if you do not have immediate access to a Server.Note: There is a file embedded within this post, please visit this post to download the file. (The x86 files are from Server 2008 and x64 are from 2008 R2)</p>
<p>Copy the files from your architecture to the system32 directory and en-US subdirectory.</p>
<h3>LogEvent</h3>
<p>To generate the custom event log entry a tool from the Windows 2000 Resource kit is used, <a href="http://support.microsoft.com/kb/315410">LogEvent</a>, (<a href="http://www.dynawell.com/download/reskit/microsoft/win2000/logevent.zip">Download</a>). This needs to be either placed in the Path (e.g. Windows dir) or scripts need to directly call it.</p>
<h2>Task Scheduler</h2>
<p>The easiest way to configure this is to manually run LogEvent once to generate an event in the log.</p>
<pre class="brush: plain; light: true;">Logevent.exe -r &quot;BackupPC&quot; -e 10 -s S &quot;Backup Start&quot;</pre>
<p>Then open Event Viewer, Select the new BackupPC event and choose <em>Attach Task to this Event</em>, and in the wizard click next until it asks for the program, then give it <strong>C:\cygwin\BackupPC\backuppc.cmd</strong></p>
<p>On Final page choose to <em>Open Properties</em> when you click Finish</p>
<p>Click the <em>Change User or Group</em> button and type in <strong>System </strong>as the user  and click OK. Also tick the <em>Run with highest privileges</em> box</p>
<h1>BackupPC Server</h1>
<h2>SSH</h2>
<p>This section is only needed if you do not already have keys generated for the backuppc user.</p>
<p>Login as backuppc user, either with password or simply “su – backuppc” from root</p>
<p>Generate SSH Keys, <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;"><em>ssh-keygen –t rsa</em></span>, do not set a password. Copy id_rsa.pub into C:\cygwin\home\backuppc\.ssh \authorized_keys</p>
<p>Test by running <em>ssh -v backuppc@host</em> to test the connection</p>
<h2>BackupPC Host File</h2>
<p>In the web interface change the following for the host.</p>
<pre class="brush: plain; light: true;">DumpPreUserCmd:  $sshPath -q -x -l backuppc $host cscript &quot;C:\cygwin\BackupPC\pre-cmd.vbs&quot;
 DumpPostUserCmd: $sshPath -q -x -l backuppc $host echo &quot;Complete: $xferOK&quot; &gt; /var/run/wake.up</pre>
<h2>Test Run</h2>
<p>If you have existing backups from a previous RSync config, it is a good idea to run a full backup to ensure any in use files are part of the base. In my case I also changed the <em>noacl </em>flag which affected the file attributes RSync sees.</p>
<h1>Tips</h1>
<p>Set your antivirus to exclude the exposed drives. As they are read only it just slows down the reading of files by RSync.</p>
<h3>Downloads</h3>
Note: There is a file embedded within this post, please visit this post to download the file.
<h1>Updates</h1>
<ul>
<li>While writing this up I found a good alternative way of using VShadow with SSH to backup in use files, that uses the AT command instead of task scheduler to get around UAC, <a href="http://geraldbrandt.com/2010/06/08/backuppc-with-sshrsyncvss-on-windows-server/">BackupPC with ssh/rsync/VSS on Windows Server</a>. The only down side to this method is the SSH connection requires an Admin account, but if configured securely this should be fine. It also a lot simpler to configure as it does not require configuring Task Scheduler.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2010/07/using-backuppc-with-diskshadow-to-backup-open-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HP Printers &#8211; &#8220;Printer driver is not installed&#8221; on Windows 2008 R2</title>
		<link>http://jrudd.org/2010/05/hp-printers-printer-driver-is-not-installed-on-windows-2008-r2/</link>
		<comments>http://jrudd.org/2010/05/hp-printers-printer-driver-is-not-installed-on-windows-2008-r2/#comments</comments>
		<pubDate>Mon, 17 May 2010 00:59:05 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Bulk Operations]]></category>
		<category><![CDATA[hp printers]]></category>
		<category><![CDATA[HPTrayCount]]></category>
		<category><![CDATA[microsoft windows]]></category>
		<category><![CDATA[print management]]></category>
		<category><![CDATA[print servers]]></category>
		<category><![CDATA[printer driver]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server 2008 R2]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=134</guid>
		<description><![CDATA[Recently I migrated all our printers from a Server 2003 R2 x32 print server to Server 2008 R2 (x64). During this upgrade all the printers had x64 drivers added and their security settings checked. However, I kept experiencing problems in Print Management with the HP printers reporting the Printer driver is not installed, even after <a href='http://jrudd.org/2010/05/hp-printers-printer-driver-is-not-installed-on-windows-2008-r2/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Recently I <a href="http://trycatch.be/blogs/roggenk/archive/2008/05/13/windows-server-2008-printer-migration-and-consolidation.aspx">migrated all our printers</a> from a <a href="http://xmstechnology.glve.be/archives/41">Server 2003 R2 x32 print server to Server 2008 R2 (x64)</a>. During this upgrade all the printers had x64 drivers added and their security settings checked. However, I kept experiencing problems in Print Management with the HP printers reporting the <em>Printer driver is not installed</em>, even after it had been repeatedly added and appeared in list of installed drivers.</p>
<p>Finally I found a <a href="http://social.technet.microsoft.com/Forums/en/winserverprint/thread/5101195b-3aca-4699-9a06-db4578614e2d">Technet discussion</a> on the issue, which correctly identified an incorrect registry value <em>HPTrayCount </em>which is set to 0 when the printer driver is changed, but is not set back to a working value.</p>
<p>This value needs to be changed to 0&#215;12 (decimal 18) for each HP printer for it to work correctly. However, on print servers with lots of HP printers this can be very time consuming. To speed this process I have written the vbscript below which will check if the value exists for each printer, and if it is set to 0 will set it to 0&#215;12.</p>
<pre class="brush: vb;">
' For each Printer in Registry check if HPTrayCount exists and is set to 0, then set to 12

'http://social.technet.microsoft.com/Forums/en/winserverprint/thread/5101195b-3aca-4699-9a06-db4578614e2d

strKeyPath = &quot;SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers&quot;
strValueName = &quot;HPTrayCount&quot;
inHPValue = 18 ' Is equal to Hex 12, makesprinter driver work.

'http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/#EnumRegVals.htm
const HKEY_LOCAL_MACHINE = &amp;H80000002
strComputer = &quot;.&quot;
Set StdOut = WScript.StdOut

Set oReg=GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\&quot; &amp; _
strComputer &amp; &quot;\root\default:StdRegProv&quot;)

' Get list of Printers
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
  ' Read in HP Tray value
  strPrintPath = strKeyPath &amp; &quot;\&quot; &amp; subkey &amp; &quot;\PrinterDriverData&quot;
  oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strPrintPath,strValueName,dwValue
  If Not IsNull (dwValue) And dwValue = 0 Then
    'If Exists and 0 then set it to a real value to make it work
    StdOut.WriteLine subkey &amp; &quot;: HP Tray: &quot; &amp; dwValue
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strPrintPath,strValueName,inHPValue
  End If
Next
</pre>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 620px; width: 1px; height: 1px; overflow: hidden;">
<pre></pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2010/05/hp-printers-printer-driver-is-not-installed-on-windows-2008-r2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Server 2008 R2 and Windows Mail</title>
		<link>http://jrudd.org/2010/02/windows-server-2008-r2-and-windows-mail/</link>
		<comments>http://jrudd.org/2010/02/windows-server-2008-r2-and-windows-mail/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 03:35:47 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[autoruns]]></category>
		<category><![CDATA[server 2008 R2]]></category>
		<category><![CDATA[SysInternals]]></category>
		<category><![CDATA[terminal server]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=126</guid>
		<description><![CDATA[I have just been setting up a new Windows Server 2008 R2 box up as a terminal server. As part of this I enabled the Desktop Experience feature, however this also enabled Windows Mail. Windows mail seems to generate large amounts of ESENT messages in the log file as it tries to backup the mail <a href='http://jrudd.org/2010/02/windows-server-2008-r2-and-windows-mail/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I have just been setting up a new Windows Server 2008 R2 box up as a terminal server. As part of this I enabled the Desktop Experience feature, however this also enabled Windows Mail.</p>
<p>Windows mail seems to generate large amounts of ESENT messages in the log file as it tries to backup the mail database. It also create 5Mb of files for every user as they logon. As we don&#8217;t even use Windows Mail, just Outlook for staff I wanted to disable it.</p>
<p>There appears to be no easy way to remove it from the system, but you can prevent it from setting up the details for every user when the log on.</p>
<p>Download and runs the <a href="http://technet.microsoft.com/en-gb/sysinternals/default.aspx">Microsoft Sysinternals</a> program <a href="http://technet.microsoft.com/en-gb/sysinternals/bb963902.aspx">Autoruns </a>as an Administrator and then under the <strong>Explorer </strong>tab untick &#8220;Microsoft Windows&#8221; under both the <strong>Active Setup\Installed Components</strong> and the <strong>WOW6432Node\Active Setup\Installed Components</strong>.</p>
<p>Now when a new user logs in it will no longer set up Windows Mail files or shortcuts.</p>
<div id="attachment_128" class="wp-caption alignright" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2010/02/WinMail-Disable.png" rel="lightbox[126]"><img class="size-medium wp-image-128" title="Autoruns Windows Mail Disable" src="http://jrudd.org/wp-content/uploads/2010/02/WinMail-Disable-300x232.png" alt="Autoruns Windows Mail Disable" width="300" height="232" /></a><p class="wp-caption-text">Autoruns Windows Mail Disable</p></div>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2010/02/windows-server-2008-r2-and-windows-mail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moodle Structure Problems</title>
		<link>http://jrudd.org/2009/06/moodle-structure-problems/</link>
		<comments>http://jrudd.org/2009/06/moodle-structure-problems/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 07:10:44 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Moodle]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Meld]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=106</guid>
		<description><![CDATA[Recently I discovered our Moodle gradebook was playing up and not correctly recording marks from assignments as well as been unable to assign categories from quizes.
I tracked the problem down to the Moodle database losing all its default entries for its tables.]]></description>
			<content:encoded><![CDATA[<p>WARNING: DO NOT ATTEMPT ANY OF THIS IF YOU DO NOT FULLY UNDERSTAND IT. YOU CAN DESTROY YOUR MOODLE SITE.</p>
<p>Recently I discovered our Moodle gradebook was playing up and not correctly recording marks from assignments as well as been unable to assign categories from quizes.</p>
<p>I tracked the problem down to the Moodle database losing all its default entries for its tables. The cause is unknown but is quite likely the <a title="UTF Convert" href="http://moodle.org/mod/forum/discuss.php?d=97592">UTF conversion utility</a> I ran previously to make the system compatible with Asian languages for LOTE.</p>
<p>To fix this problem I needed to recreate the Moodle DB structure and then reimport the data.</p>
<h2>Backup</h2>
<p>First make a backup. I made a mistake the first time I tried repairing this and the backup I made saved me.</p>
<pre class="brush: bash;">mysqldump -u backupacc -p -Q --opt moodle &gt; moodleBackup.sql</pre>
<p>I created a duplicate site with a clean DB (copy the moodle folder and create a new DB) and went through the install. This needs to have all your modules and blocks to ensure all tables are created.</p>
<p>I then dumped the structure from this new DB and the old DB and compared them using Meld (or any other diffing program will work).</p>
<pre class="brush: bash;"> mysqldump -u backupacc -p --no-data --skip-add-drop-table moodletest2 &gt; moodleGoodStruc.sql
mysqldump -u backupacc -p -d --skip-add-drop-table moodle &gt; moodleOldStruc.sql</pre>
<p>Using Meld determine if there are any extra tables or fields in your current system that don&#8217;t exist in the clean one.</p>
<p>Then you need to determine if it is safe to delete those tables / field in your main DB or if they need to be added to the clean system. e.g. grade_items_history.decimals and grade_items_history.display were in the main DB but not the new one. After searching for it discovered they can be removed (<a href="http://tracker.moodle.org/browse/MDL-15985">MDL-15985</a>).</p>
<p>After getting them to match you need to dump your Moodle data from your main site.</p>
<p>You can speed up the next steps by reducing the size of backup_log if you wish. Just do a</p>
<pre class="brush: sql;">
Delete
FROM `mdl_backup_log`
WHERE `time` &lt;1242777600
</pre>
<p>Where the time code is <a href="http://converteverything.com/conversions/unix_time.htm">calculated as a unix time code</a> from about a month before todays date. This can reduce alot of space of your DB, and improve import/export times.</p>
<pre class="brush: bash;">mysqldump -u backupacc -p  --no-create-info --extended-insert --complete-insert moodle &gt; moodleData200906171559.sql</pre>
<p>You need the <strong>&#8211;complete-insert</strong> option to ensure each insert is labelled with field name, in case field order is different. I didn&#8217;t do this the first time and needed to restore the backup.</p>
<h2>Testing Merge</h2>
<p>Now you need to test it. Create a new empty DB and import the Structure then import your data.</p>
<pre class="brush: bash;">mysql -u root -p moodleTest3 &lt; moodleStruc.sql
mysql -u root -p moodleTest3 &lt; moodleData200906171559.sql</pre>
<p>Check that no errors occurred during import, this is when I discovered most of my problems with extra non existent field.</p>
<h2>Prep for Applying</h2>
<p>Put your site in Maintenance mode so no users can login while you are testing this. (i.e. when you restore data site will already be in maintenance mode)</p>
<p>When everything is OK do another backup, as after this you are going to <strong>delete it all</strong>. (I recommend taking your site completely offline for this, not just maintenance mode. Edit your config.php and temporarily change either the username, password or db name or your database settings.)</p>
<p>Now re-export the Data again (assuming your site has been running while you have been doing tests)</p>
<pre class="brush: bash;">mysqldump -u backupacc -p  --no-create-info --extended-insert --complete-insert moodle &gt; moodleData200906171559.sql</pre>
<h2>Applying to Site</h2>
<p><strong>WARNING: HAVE A GOOD RELIABLE BACKUP BEFORE THIS STEP.  THIS WILL DESTROY YOUR MOODLE SITE.</strong></p>
<p>Now use phpMyAdmin to drop every table in the Moodle main DB. Just use Check All at the bottom and select Drop.</p>
<p>Now you need to redo your test restore above but to your main DB.</p>
<p>Once complete reconnect your config.php file and check everything on your site looks the same. Open some courses, check some gradebooks, have a look around.</p>
<p>When its OK take out of Maintenance mode and you should be good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2009/06/moodle-structure-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Earth Zenworks Deployment</title>
		<link>http://jrudd.org/2009/02/google-earth-zenworks-deployment/</link>
		<comments>http://jrudd.org/2009/02/google-earth-zenworks-deployment/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 04:26:02 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[AdminUser]]></category>
		<category><![CDATA[ChangeInstallDirForNonAdmin]]></category>
		<category><![CDATA[Condition]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[deployment program]]></category>
		<category><![CDATA[google earth]]></category>
		<category><![CDATA[InstallExecuteSequence]]></category>
		<category><![CDATA[InstallUISequence]]></category>
		<category><![CDATA[local settings]]></category>
		<category><![CDATA[MSI]]></category>
		<category><![CDATA[orca]]></category>
		<category><![CDATA[School]]></category>
		<category><![CDATA[Zenworks]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=98</guid>
		<description><![CDATA[How to deploy Google Earth to C:\Program Files\Google\Google Earth instead of Local Settings\Application Data\Google\Google Earth by removing AdminUser checks from the MSI.]]></description>
			<content:encoded><![CDATA[<p><a href="http://earth.google.com/">Google Earth</a> is a great program for schools, as it allows teachers and students to explore the worlds geography and use layers to examine  history, socio-economic information and many other areas.</p>
<p>It used to be fairly easier to deploy on your network, but after version 4.2 it became significantly more difficult if you use a deployment program like Zenworks. A new MSI test was introduced to determine where to install Google Earth. If the current user is not an Admin User it would redirect to <em>[LocalAppDataFolder]Google\Google Earth</em> (usually C:\Documents and Settings\username\Local Settings\Application Data\Google\Google Earth) which made it inaccessible to other users.</p>
<p>As Zenworks uses the System account, which is not an admin user, this would happen when the installer was launched by a student.</p>
<p>To fix this problem there are a few different techniques. You can use either <a href="http://www.technipages.com/download-orca-msi-editor.html">ORCA </a>or Admin Studio Tuner (from Zenworks) to create a transform file that ignores these checks. Alternatively you can use ORCA to edit the msi file directly, I had to use this technique for V5 due to some exisiting problems in the Google Earth MSI.</p>
<p>First download the full version of Google Earth, (<a href="http://dl.google.com/earth/client/GE5/release_5_0/GoogleEarth-Win-Plus-5.0.11337.1968.exe">V5.0.11337</a>). You should be able to find later versions through Google.</p>
<p>To find what you need to edit you can do a search in ORCA for <em>AdminUser </em>you should find around 3 entries.</p>
<p>The major entries are:</p>
<ul>
<li><em>InstallExecuteSequence: ChangeInstallDirForNonAdmin: NOT AdminUser</em> (Delete this row)</li>
<li><em>InstallExecuteSequence: setALLUSERS: AdminUser</em> (remove the word AdminUser so it applies to all installs)</li>
<li><em>InstallUISequence: ChangeInstallDirForNonAdmin: NOT AdminUser</em> (Delete this row)</li>
</ul>
<p>You may also wish to remove <em>AdminUser </em>as a <em>Condition </em>from <em>Component: Plus_Registry_wavdest.ax</em></p>
<p>Once these are removed or modified it should install in C:\Program Files\Google\Google Earth regardless of which user is logged in.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2009/02/google-earth-zenworks-deployment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating DHCP reservations from Novell to Microsoft</title>
		<link>http://jrudd.org/2009/02/migrating-dhcp-reservations-from-novell-to-microsoft/</link>
		<comments>http://jrudd.org/2009/02/migrating-dhcp-reservations-from-novell-to-microsoft/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 01:36:36 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Novell]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[dhcp reservations]]></category>
		<category><![CDATA[dhcp server service]]></category>
		<category><![CDATA[dhcp servers]]></category>
		<category><![CDATA[eDirectory]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[novell dhcp]]></category>
		<category><![CDATA[novell servers]]></category>
		<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=71</guid>
		<description><![CDATA[We are gradually migrating our core services from Netware to Windows Server 2003 and 2008. As part of this migration we needed to migrate all our DHCP reservations stored on our Novell servers to Windows Servers. ]]></description>
			<content:encoded><![CDATA[<p>We are gradually migrating our core services from Novell Netware to Windows Server 2003 and 2008. As part of this migration we needed to migrate all our DHCP reservations stored on our Novell servers to Windows Servers.</p>
<p>First a comment, although Microsoft seems to have a much better DNS system than on Netware 6.5, their DHCP implementation leaves a lot to be desired.</p>
<p>On Novell I could create a scope, reservations and options and it is stored in eDirectory. I could then have multiple DHCP servers with different IP ranges to offer. I could use the java console (sometime slow) to add a reservation and it would sync to both servers.</p>
<p>On Windows Server 2003 and 2008 I need to separate create scopes, allocation ranges and reservations on each server. Their is no synchronisation or communication between these servers. This means to migrate my reservations from my current Netware DHCP servers to the target Windows servers the reservations need to be added to each server, as well as adding any future reservations to both servers.</p>
<h2>Migration Process</h2>
<p>First use the Novell DNS/DHCP console and export the DHCP scope / database you are migrating.</p>
<p>I have written the following Perl code to read in the DHCP3TAB file generated and output a netsh file that will add all your reservations to any number of Windows DHCP servers.</p>
<p>You will need to modify the DHCP servers list to your AD servers and change the scopeName to the correct IP settings.</p>
<p>After running your DHCP3TAB through the perl script, copy output to your server and run <em>netsh exec outputFile.txt</em> to add it to your servers.</p>
<pre class="brush: perl;">
#!C:\Perl\bin\perl.exe

# Designed to read in Rservations from a Novell DHCP Tab file and output a NetSH script file
# From http://technet.microsoft.com/en-us/library/cc787375.aspx
# On the destination server, the exec command is used to load and execute the converted reservations:
#  netsh exec AdReservations.txt
# After you use the exec command to load the file, you must reconcile all scopes.
# Use net stop dhcpserver to stop the DHCP Server service and net start dhcpserver to restart it. Once the service is restarted, DHCP database changes take effect.

use strict; use warnings;

my $dhcptabName = &quot;DHCP3TAB.txt&quot;;
my $outFile = &quot;AdReservations.txt&quot;;
my @dhcpServers = ('\\\\DHCPServer1.win.us.schools.nsw.edu.au',
    '\\\\DHCPServer2.win.us.schools.nsw.edu.au');
my $scopeName = &quot;10.10.11.0&quot;;

open F, &quot;&lt; $dhcptabName&quot; or die &quot;Can't open $dhcptabName : $!&quot;;
open O, &quot;&gt; $outFile&quot; or die &quot;Can't open $outFile : $!&quot;;

# File parsing
my $ip;
my $host;
my $mac;
my $type;
my $comment=&quot;&quot;;

while (my $line = &lt;F&gt;){
  if ($line =~ /^\[IP Address Configuration /i) {
  # New entry, clear values
    $ip=&quot;&quot;, $host=&quot;&quot;, $mac=&quot;&quot;, $type=&quot;&quot;, $comment=&quot;&quot;;

    while ((my $entry = &lt;F&gt;) !~ /^$/){
    # Parse and fill in values
      if ($entry =~ /IP Address Number = ([\d.]+)/i){
        $ip=$1;
      }
      elsif ($entry =~ /Assignment Type = (\d+)/i){
        $type=$1;
      }
      elsif ($entry =~ /Host Name = ([\w\-_]+)/i){
        $host=$1;
      }
      elsif ($entry =~ /MAC Address = 1 (.+)/i){
        $mac=$1;
        $mac=~ s/\s+//g;
      }
      elsif ($entry =~ /Comment = (.+)/i){
        $comment=$1;
      }
    }

    # Following determines which type of entries to convert. Default is only reservation.
    # You can comment it out and uncomment the second line to include reservations and allocated IPs.
    # If  type != 8 (reservation) discard
    next unless ($type == 8); 

    # If  type != 8 (reservation) or  != 2 (Allocated) discard
    # next unless  ($type  == 8 or $type  == 2);

    next if ($mac eq &quot;&quot; or $ip eq &quot;&quot; or $host eq &quot;&quot;);
    foreach my $server (@dhcpServers){
      print O &quot;Dhcp Server $server Scope $scopeName Add reservedip $ip $mac \&quot;$host\&quot; \&quot;$comment\&quot; \&quot;BOTH\&quot;\n&quot;;
    }
  }
}

close F;
close O;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2009/02/migrating-dhcp-reservations-from-novell-to-microsoft/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Renaming Novell user accounts</title>
		<link>http://jrudd.org/2008/12/renaming-novell-user-accounts/</link>
		<comments>http://jrudd.org/2008/12/renaming-novell-user-accounts/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 01:24:08 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[Novell]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[account]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[eDirectory]]></category>
		<category><![CDATA[home directories]]></category>
		<category><![CDATA[login names]]></category>
		<category><![CDATA[novell edirectory]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[username]]></category>
		<category><![CDATA[usernames]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=43</guid>
		<description><![CDATA[Recently we had to change the login names for around 1200 students. As part of this rename we needed to change their Novell eDirectory account and home directory. We also needed to ensure linked systems such as an LDAP authenticated Moodle site and an IDM linked Active Directory (AD) domain were properly updated. To perform <a href='http://jrudd.org/2008/12/renaming-novell-user-accounts/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Recently we had to change the login names for around 1200 students.</p>
<p>As part of this rename we needed to change their Novell eDirectory account and home directory. We also needed to ensure linked systems such as an LDAP authenticated <a href="http://moodle.org/" target="_blank">Moodle </a>site and an IDM linked Active Directory (AD) domain were properly updated.</p>
<p>To perform the user account and folder rename we used <a href="http://www.hbware.com/content/view/61/12/" target="_blank">Mass User</a> from <a href="http://www.hbware.com/" target="_blank">HBWare</a>. This is a great program we already used for creating and managing home directories and quotas. There was a small bug in the rename area, but it was quickly fixed when brought to Hans’ attention.<br />
Note: Before beginning you need to have a list of the old usernames and the new usernames.  A simple two column Excel or CSV file would be fine.</p>
<h2>Novell</h2>
<p>Create Mapping File: The mapping file is used by Mass User to know what to rename the existing username to.</p>
<p>Use <a href="http://www.novell.com/coolsolutions/tools/13908.html">NDS Report</a> ( http://www.novell.com/coolsolutions/tools/13908.html ) to create a list of all the accounts. You only want the DN and CN fields. Save this as an Excel or CSV file.</p>
<div id="attachment_50" class="wp-caption alignnone" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2008/12/1andsrepcontainer.png" rel="lightbox[43]"><img class="size-medium wp-image-50" title="NDS Report: Select Student OU" src="http://jrudd.org/wp-content/uploads/2008/12/1andsrepcontainer-300x251.png" alt="NDS Report: Select Student OU" width="300" height="251" /></a><p class="wp-caption-text">NDS Report: Select Student OU</p></div>
<div id="attachment_51" class="wp-caption alignnone" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2008/12/1bndsrepuser.png" rel="lightbox[43]"><img class="size-medium wp-image-51" title="NDS Report: Choose only CN" src="http://jrudd.org/wp-content/uploads/2008/12/1bndsrepuser-300x249.png" alt="NDS Report: Choose only CN" width="300" height="249" /></a><p class="wp-caption-text">NDS Report: Choose only CN</p></div>
<p>Create a new MS Access file and import the account list<br />
Import the text / excel file that lists the old and new account names.<br />
You now need to create a query that maps the cn to the old account name, and then use this to generate a list of the full old dn and the new account name.</p>
<div id="attachment_53" class="wp-caption alignnone" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2008/12/2aaccessmapping.png" rel="lightbox[43]"><img class="size-medium wp-image-53" title="Access: Mapping Query" src="http://jrudd.org/wp-content/uploads/2008/12/2aaccessmapping-300x274.png" alt="Access: Mapping Query" width="300" height="274" /></a><p class="wp-caption-text">Access: Mapping Query</p></div>
<div id="attachment_54" class="wp-caption alignnone" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2008/12/2baccessdata.png" rel="lightbox[43]"><img class="size-medium wp-image-54" title="Access: Query Results" src="http://jrudd.org/wp-content/uploads/2008/12/2baccessdata-300x206.png" alt="Access: Query Results" width="300" height="206" /></a><p class="wp-caption-text">Access: Query Results</p></div>
<p>You can then export this as a text file.</p>
<div id="attachment_55" class="wp-caption alignnone" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2008/12/2caccessexport1.png" rel="lightbox[43]"><img class="size-medium wp-image-55" title="Access: Export as Text file" src="http://jrudd.org/wp-content/uploads/2008/12/2caccessexport1-300x195.png" alt="Access: Export as text file" width="300" height="195" /></a><p class="wp-caption-text">Access: Export as text file</p></div>
<div id="attachment_56" class="wp-caption alignnone" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2008/12/2daccessexport2.png" rel="lightbox[43]"><img class="size-medium wp-image-56" title="Access: Export Delimited" src="http://jrudd.org/wp-content/uploads/2008/12/2daccessexport2-300x212.png" alt="Access: Export Delimited" width="300" height="212" /></a><p class="wp-caption-text">Access: Export Delimited</p></div>
<p>You will need to set the field separate as ‘=’ and set the test qualifier to none.</p>
<div id="attachment_57" class="wp-caption alignnone" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2008/12/2eaccessexport3.png" rel="lightbox[43]"><img class="size-medium wp-image-57" title="Access: Export = Delimiter and no Text Qualifier" src="http://jrudd.org/wp-content/uploads/2008/12/2eaccessexport3-300x213.png" alt="Access: = as Delimiter and no Text Qualifier" width="300" height="213" /></a><p class="wp-caption-text">Access: = as Delimiter and no Text Qualifier</p></div>
<p>You should end up with each line having format:<br />
OLDNAME.OU.C=NEWNAME<br />
Once the mapping file is generated you can apply it either to individual OUs (e.g. year groups), or to the entire Users container. I would recommend applying to small containers initially to allow checking for errors. After verifying all renames were performed correctly you can then apply the rename to your entire users’ container.</p>
<div id="attachment_58" class="wp-caption alignnone" style="width: 310px"><a href="http://jrudd.org/wp-content/uploads/2008/12/massuserrename.png" rel="lightbox[43]"><img class="size-medium wp-image-58" title="Mass User: Rename" src="http://jrudd.org/wp-content/uploads/2008/12/massuserrename-300x234.png" alt="Mass User: Rename" width="300" height="234" /></a><p class="wp-caption-text">Mass User: Rename</p></div>
<h2>IDM 3.0 – Active Directory</h2>
<p>Before doing the mass rename we did some simple tests of renaming eDirectory accounts to see how they replicated to Active Directory. We determined that the individual renames were successfully propagated through IDM to automatically change the pre-2000 and logon name fields to match the new eDirectory account.<br />
When performing the mass rename of accounts, AD was checked after doing each OU to check propagation was successful. We experienced no problems with IDM and all accounts were successfully synchronised with Active Directory.</p>
<h2>Moodle</h2>
<p>For Moodle we wished for users to retain their own accounts including all their settings and course information.  To do this the username stored in the Moodle Database (DB) would need to be changed to the new username.<br />
Before making changes to Moodle I recommend putting the site in admin mode and temporarily disabling your LDAP authentication. I only put the site in Admin mode and then had problems during migration as some students had attempted to logon after I had renamed the eDirectory accounts, but before migrating Moodle accounts. This created new user accounts in Moodle that prevented the update queries running due to duplicate key name problems (ie the old account would not rename to new one if one has already been created with the new name)<br />
First you need to import your list of old and new account names into the database. If you already have it in a separate DB on your Moodle server you can use that, otherwise it is best to just to create a new table in the Moodle DB.<br />
I used this query to check the mapping fields. You will need to adjust the fields and collation types for your own setup.<br />
I use the IDNumber field to store the full DN, if you use a different field you will need to adjust this.</p>
<h3>Validation:</h3>
<p><code># Shows the current username, the new username and the new IDNumber field for validation check.<br />
SELECT mdl.`username` , ern.`StudentId` , replace( `idnumber` , mdl.`username` , ern.`StudentId`<br />
COLLATE latin1_swedish_ci )<br />
FROM moodle.`mdl_user` mdl, sbhsdata.`oasisStudentIdMap` ern<br />
WHERE mdl.`username`<br />
COLLATE latin1_general_ci = ern.`OldStudentId`</code></p>
<h3>Update:</h3>
<p><code># Replaces the IDNumber field with the new username.<br />
UPDATE moodle.`mdl_user` mdl, sbhsdata.`oasisStudentIdMap` ern<br />
SET  `idnumber` = replace( `idnumber` , mdl.`username` , ern.`StudentId` COLLATE latin1_swedish_ci )<br />
WHERE mdl.`username`<br />
COLLATE latin1_general_ci = ern.`OldStudentId`</code></p>
<p><code># Replaces the mdl_user field with the new username.<br />
UPDATE `mdl_user` mdl, `rename` ren<br />
SET  mdl.`username` = ren.`newname`<br />
WHERE mdl.`username`= ren.`oldname`</code><br />
Note: As can be seen by the queries, during the migration I did two separate updates, one to update the IDNumber field and another to update the mdl_user field. When I had completed migration I realised I had only needed to update the mdl_user field as Moodle would automatically update the value in IDNumber at next log on.</p>
<h2>Round Up</h2>
<p>The migration to the new accounts went well with no problems from student passwords or accounts, although we had a few instances of students using the old username instead of the new one.</p>
<p>Since performing the change we have also implemented a <a href="http://www.papercut.com/products/ng/">Papercut</a> system which would have required the additional step of <a href="http://www.papercut.com/kb/Main/RenameUserAccounts">renaming</a> all of its accounts to ensure student balances were carried across.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2008/12/renaming-novell-user-accounts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AD Password Reset and Bulk Modify</title>
		<link>http://jrudd.org/2008/12/ad-password-reset-and-bulk-modify/</link>
		<comments>http://jrudd.org/2008/12/ad-password-reset-and-bulk-modify/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 08:28:34 +0000</pubDate>
		<dc:creator>James Rudd</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Modify]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[password control]]></category>
		<category><![CDATA[sAMaccountName]]></category>
		<category><![CDATA[student passwords]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[username]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[Wisesoft]]></category>

		<guid isPermaLink="false">http://jrudd.org/wordpress/?p=45</guid>
		<description><![CDATA[Those who in the past have used the Novell Change Pass utility may have been missing it when moving to Active Directory. A great tool is Wisesoft Password Control which allows you to just type in the username, it will display info about the account and give you the option to change the password, enable/disable <a href='http://jrudd.org/2008/12/ad-password-reset-and-bulk-modify/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Those who in the past have used the Novell Change Pass utility may have been missing it when moving to Active Directory.</p>
<p>A great tool is <a href="http://www.wisesoft.co.uk/Products/PasswordControl/Main/default.aspx" target="_blank">Wisesoft Password Control</a> which allows you to just type in the username, it will display info about the account and give you the option to change the password, enable/disable the account and unlock the account.<br />
It is ideal to make available to teachers for resetting the student passwords if you use the Delegate control option in AD Users and Computers for your student OU&#8217;s.</p>
<p>The other useful tool on the website is a pair of tools <a href="http://www.wisesoft.co.uk/Products/PasswordControl/BulkPasswordControl/default.aspx" target="_blank">Bulk Password Control</a> and <a href="http://www.wisesoft.co.uk/Products/PasswordControl/BulkModify/Default.aspx" target="_blank">Bulk Modify</a>. These allow you to bulk reset the password for a large group of students, or modify the attributes for a large number of users. It can read these in from a CSV file, and match the CSV entires to either sAMaccountName or some other user attribute. You can also set the attribute based on their existing attributes.</p>
<p>After downloading it will ask you for a code that you can get with a free <a href="http://www.wisesoft.co.uk/Login/Register.aspx" target="_blank">registration </a>on their site.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrudd.org/2008/12/ad-password-reset-and-bulk-modify/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
