<?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>JJClements.co.uk &#187; Command Line</title>
	<atom:link href="http://www.jjclements.co.uk/index.php/category/command-line/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jjclements.co.uk</link>
	<description>Clem&#039;s Technical Blog</description>
	<lastBuildDate>Tue, 08 Jun 2010 22:26:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Windows Server time synchronization</title>
		<link>http://www.jjclements.co.uk/2010/04/15/windows-server-time-synchronization/</link>
		<comments>http://www.jjclements.co.uk/2010/04/15/windows-server-time-synchronization/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 09:08:58 +0000</pubDate>
		<dc:creator>James Clements</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Registry]]></category>
		<category><![CDATA[Windows Server 2003]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[nt5ds]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[pdc]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[w32time]]></category>

		<guid isPermaLink="false">http://www.jjclements.co.uk/?p=781</guid>
		<description><![CDATA[Something I have frequently seen implemented incorrectly on Windows Server domains is time synchronization. Many admins think that by creating a GPO with a modified policy setting for 'Configure Windows NTP Client' (and using it to address an NTP source) all Servers and Clients will synchronize their time with that source. This isn't entirely true [...]]]></description>
			<content:encoded><![CDATA[<p>Something I have frequently seen implemented incorrectly on Windows Server domains is time synchronization. Many admins think that by creating a GPO with a modified policy setting for 'Configure Windows NTP Client' (and using it to address an NTP source) all Servers and Clients will synchronize their time with that source. This isn't entirely true and there is actually a time hierarchy that should be considered when implementing time synchronization for each domain.</p>
<p><span id="more-781"></span></p>
<p>As far as W32Time (the Windows time service) is concerned, at the topmost level within the domain is the domain controller on which the <a rel="nofollow" href="http://en.wikipedia.org/wiki/Primary_Domain_Controller#Windows_2000:_PDC_emulation" target="_blank">PDC Emulator</a> Flexible Single Master Operation <a rel="nofollow" href="http://en.wikipedia.org/wiki/Flexible_single_master_operation" target="_blank">(FSMO)</a> role resides. This can be configured to synchronize it's time with a <a rel="nofollow" href="http://www.pool.ntp.org/en" target="_blank">reliable external time source</a>. By default all other domain controllers internally synchronize their time with the PDC Emulator. Similarly all domain member client computers synchronize their time with the domain controller that authenticates them.</p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/04/timesync.png" alt="timesync.png" /></p>
<p>Configuring the domain controller where the PDC Emulator role resides should be the only computer in the domain that requires any manual intervention to have the precise time on all domain client computers.</p>
<p>To find out which server the PDC Emulator role resides on open the Active Directory Users and Computers (ADUC) snap-in. Then right click on your domain and select 'Operations Masters'. Browsing the PDC tab will show you where the PDC Emulator role currently resides.</p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/04/pdcemulator.png" alt="pdcemulator.png" /></p>
<p>On the domain controller where the PDC Emulator resides you can configure it to synchronize its time with an external source by using the following command:</p>
<p><strong>net time /setsntp:&lt;ip/dns&gt;</strong></p>
<p>Use the following example to set multiple external time sources to sync with:</p>
<p><strong>net time /setsntp:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org"</strong></p>
<p>You can also configure this manually by modifying the following registry key:</p>
<p>HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters</p>
<p><strong>NtpServer=&lt;ip/dns&gt;</strong><br />
<strong>Type=NT5DS</strong> change this to <strong>Type=NTP</strong></p>
<p>After making the above changes restart the W32Time service by issuing the following commands at a command prompt:</p>
<p><strong>net stop w32time</strong><br />
<strong>net start w32time</strong></p>
<p>NOTE: If you don't configure the PDC Emulator to synchronize its time with an external source it will simply use its own (CMOS) clock. Doing so will occasionally cause an error to appear in the event log on the server that resembles the following:</p>
<blockquote><p>
Event Type: Error<br />
Event Source: W32Time<br />
Event Category: None<br />
Event ID: 12</p>
<p>Event description: Time Provider NtpClient: This machine is configured to use the domain hierarchy to determine its time source, but it is the PDC emulator for the domain at the root of the forest, so there is no machine above it in the domain hierarchy to use as a time source.
</p></blockquote>
<p>NOTE: If you experience a client with time synchronization problems ensure that it has the correct time zone set. If needed, the time service can be reset using the following commands:</p>
<p><strong>net stop w32time</strong><br />
<strong>w32tm /unregister</strong><br />
<strong>w32tm /register</strong><br />
<strong>net start w32time</strong><br />
<strong>w32tm /resync</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjclements.co.uk/2010/04/15/windows-server-time-synchronization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint 2007 documents not opening in Office 2007</title>
		<link>http://www.jjclements.co.uk/2010/03/24/sharepoint-2007-documents-not-opening-in-office-2007/</link>
		<comments>http://www.jjclements.co.uk/2010/03/24/sharepoint-2007-documents-not-opening-in-office-2007/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 17:39:18 +0000</pubDate>
		<dc:creator>James Clements</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[MOSS 2007]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[owssupp.dll]]></category>

		<guid isPermaLink="false">http://www.jjclements.co.uk/?p=693</guid>
		<description><![CDATA[Our company Intranet was deployed on Microsoft Office SharePoint Server (MOSS) 2007 and has been in operation for a few months. I recently had a user that reported that they were experiencing difficulties opening documents from their Team Site. A quick check revealed this problem actually affected all documents for the user and not just [...]]]></description>
			<content:encoded><![CDATA[<p>Our company Intranet was deployed on Microsoft Office SharePoint Server (MOSS) 2007 and has been in operation for a few months. I recently had a user that reported that they were experiencing difficulties opening documents from their Team Site. A quick check revealed this problem actually affected all documents for the user and not just those in their Team Site. When the user clicked on any SharePoint document to open it they were presented with the dialog box with options to open the document in 'Read Only' or 'Edit' mode. Opening any document in 'Read Only' mode opened the document in the relevant Microsoft Office application but obviously did not allow them to save it directly back into SharePoint. Opening any document in 'Edit' mode failed to launch the Microsoft Office application associated with that document. This was the case for all Microsoft Office document types.</p>
<p><span id="more-693"></span></p>
<p>As the issue did not affect anyone else I made the assumption it was local to the computer. I had a quick look at the Internet Explorer addons that were loaded and could see that the 'SharePointOpenDocuments' was enabled (as it should have been.)</p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/03/microsoftsharepointaddon.png" alt="microsoftsharepointaddon.png" /></p>
<p>Since the addon was being loaded and in part seemed to be working I had a quick look to see if multiple versions of owssupp.dll existed. owssupp.dll is the Microsoft Office SharePoint Client Support library used by Internet Explorer as the addon called 'SharePointOpenDocuments'. When the addon is loaded and you attempt to open a document from a SharePoint site it displays a small dialog box prompting the user to choose between opening the document in 'Read Only' or 'Edit' mode.</p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/03/sharepointopendialogue.png" alt="sharepointopendialogue.png" /></p>
<p>The library owssupp.dll is installed to C:\Program Files\Microsoft Office\Office(##) and I had heard of issues where multiple versions of the file had existed on a computer (as a result of a Microsoft Office upgrade) and caused issues. I only had one instance of owssupp.dll located in C:\Program Files\Microsoft Office\Office12 so I ruled this out.</p>
<p>The next thing I tried was re-registering the .dll on the computer. I closed all instances of Microsoft Office applications and then at a command prompt I ran the following:</p>
<p>regsvr32 "C:\Program Files\Microsoft Office\Office12\OWSSUPP.DLL"</p>
<p>I received the following error message:</p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/03/sharepointdllerror.png" alt="sharepointdllerror.png" /></p>
<p>I clicked OK to close the message box. I opened Internet Explorer and navigated to the Team Site. Upon clicking on a document and selecting 'Edit' from the dialog box the correct Microsoft Office application opened and I was able to edit the document normally.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjclements.co.uk/2010/03/24/sharepoint-2007-documents-not-opening-in-office-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH SCP Hyperlink</title>
		<link>http://www.jjclements.co.uk/2010/03/13/ssh-scp-hyperlink/</link>
		<comments>http://www.jjclements.co.uk/2010/03/13/ssh-scp-hyperlink/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 11:18:57 +0000</pubDate>
		<dc:creator>James Clements</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows Vista]]></category>
		<category><![CDATA[Windows XP]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[.bat]]></category>
		<category><![CDATA[hyperlink]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[winscp]]></category>

		<guid isPermaLink="false">http://www.jjclements.co.uk/?p=646</guid>
		<description><![CDATA[Following on from a previous post about creating and using an RDP Hyperlink on a computer running Windows, I have written another two .bat files for use with SSH and SCP protocols. SSH Hyperlink The first .bat file allows for easy installation/uninstallation of the SSH hyperlink association. It is used for a hyperlink with an [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from a previous post about creating and using an <a rel="nofollow" href="http://www.jjclements.co.uk/index.php/2010/02/21/rdp-hyperlink" target="_blank">RDP Hyperlink</a> on a computer running Windows, I have written another two .bat files for use with SSH and SCP protocols.</p>
<p><span id="more-646"></span></p>
<p><span style="text-decoration: underline;"><strong>SSH Hyperlink</strong></span></p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/03/sshoptions.png" alt="sshoptions.png" /></p>
<p>The first .bat file allows for easy installation/uninstallation of the SSH hyperlink association. It is used for a hyperlink with an associated prefix of ssh://. The bat file will invoke a 3rd party SSH client and establish a connection to the host.</p>
<p>To create and use a hyperlink that is prefixed by ssh:// you will first need to download the latest copy of putty.exe - <a rel="nofollow" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">HERE</a></p>
<p>Save or move putty.exe (rename to this if different) to C:\WINDOWS\System32\</p>
<p>Download ssh.bat - <a rel="nofollow" href="http://www.jjclements.co.uk/wp-content/uploads/2010/03/ssh.zip" target="_blank">HERE</a></p>
<p>Extract and run ssh.bat to create the scp:// hyperlink association on your computer.</p>
<p><span style="text-decoration: underline;"><strong>SCP Hyperlink</strong></span></p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/03/scpoptions.png" alt="scpoptions.png" /></p>
<p>The second .bat file allows for easy installation/uninstallation of the SCP hyperlink association. It is used for a hyperlink with an associated prefix of scp://. The bat file will invoke a 3rd party SCP client and establish a connection to the host.</p>
<p>To create and use a hyperlink that is prefixed by scp:// you will first need to download the latest copy of WinSCP.exe - <a rel="nofollow" href="http://winscp.net/eng/download.php" target="_blank">HERE</a> (use the link for 'Portable executables')</p>
<p>Save or move WinSCP.exe (rename to this if different) to C:\WINDOWS\System32\</p>
<p>Download scp.bat - <a rel="nofollow" href="http://www.jjclements.co.uk/wp-content/uploads/2010/03/scp.zip" target="_blank">HERE</a></p>
<p>Extract and run scp.bat to create the scp:// hyperlink association on your computer.</p>
<p><span style="text-decoration: underline;"><strong>Notes</strong></span></p>
<p>After completing the above, any hyperlinks prefixed with ssh:// and/or scp:// will automatically be opened and a connection attempt made.</p>
<p>A hyperlink of:</p>
<p>ssh://someserver</p>
<p>would run putty.exe and attempt to connect to 'someserver'.</p>
<p>For more info about using these hyperlinks on webpages and within <a rel="nofollow" href="http://www.zenoss.com" target="_blank">Zenoss</a> check:</p>
<p><a rel="nofollow" href="http://www.jjclements.co.uk/index.php/2010/02/21/rdp-hyperlink" target="_blank">RDP Hyperlink</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjclements.co.uk/2010/03/13/ssh-scp-hyperlink/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RDP Hyperlink</title>
		<link>http://www.jjclements.co.uk/2010/02/21/rdp-hyperlink/</link>
		<comments>http://www.jjclements.co.uk/2010/02/21/rdp-hyperlink/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 19:38:42 +0000</pubDate>
		<dc:creator>James Clements</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows Vista]]></category>
		<category><![CDATA[Windows XP]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[.bat]]></category>
		<category><![CDATA[hyperlink]]></category>
		<category><![CDATA[RDP]]></category>

		<guid isPermaLink="false">http://www.jjclements.co.uk/?p=550</guid>
		<description><![CDATA[I recently started using Zenoss (an open source application, server and network management platform) to monitor servers. One of the options that can be configured for each of the devices being managed is a hyperlink that can open a website or application of some relevance. In a situation where I am informed of an issue [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started using <a href="http://www.zenoss.com" target="_blank" rel="nofollow">Zenoss</a> (an open source application, server and network management platform) to monitor servers. One of the options that can be configured for each of the devices being managed is a hyperlink that can open a website or application of some relevance. In a situation where I am informed of an issue with a server/application I instinctively try to open a Windows remote desktop session to the server. This used to involve manually opening the Microsoft Terminal Services Console (mstsc.exe), keying the server name and then clicking the connect button. I wanted a way to click a hyperlink from the <a href="http://www.zenoss.com" target="_blank" rel="nofollow">Zenoss</a> web console and establish an rdp session to the relevant server.</p>
<p><span id="more-550"></span></p>
<p>Since some protocols are identified by a prefix (ftp:// http:// https://) I decided to use rdp:// as the prefix to launch mstsc.exe. I have combined the necessary registry keys and the required JScript file into a single .bat file that allows for easy installation/uninstallation of the rdp hyperlink association. When you run rdp.bat you are presented with 3 options:</p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/02/rdpoptions.png" alt="rdpoptions.png" /></p>
<p><strong>Option 1.</strong> Adds registry key HKCR\rdp which contains the parameters needed to associate the rdp:// prefix with a file created in C:\Windows called hyperlink-rdp.js. The JScript file is responsible for some string manipulation that trims the rdp:// prefix and then passes the remaining string (server name) to mstsc.exe to try and establish the rdp session.</p>
<p><strong>Option 2.</strong> Removes registry key HKCR\rdp and the C:\Windows\hyperlink-rdp.js file.</p>
<p><strong>Option 3.</strong> Exits the batch file.</p>
<p>After you use rdp.bat to create the hyperlink association you can launch an rdp session by clicking any hyperlink in the form of:</p>
<p><a href="rdp://someserver">rdp://someserver</a></p>
<p>Typing rdp://someserver into your browser or windows explorer address bar will also launch the Microsoft Terminal Services Console and attempt to establish a session.</p>
<p>Note: When clicking an rdp:// hyperlink for the first time from a browser it is likely that you will receive a prompt that the browser is trying to launch a local application. You will need to allow this in order for the Microsoft Terminal Services Console to be opened and a session established.</p>
<p>After creating the rdp association on my Windows computer I added a specific link to the device in my Zenoss web console by:</p>
<p>1) Navigating to the device<br />
2) Clicking the options drop down arrow<br />
3) Selecting More --> zProperties<br />
4) Adding a HTML hyperlink to the zLinks property</p>
<p>The syntax for a standard HTML hyperlink is:</p>
<blockquote><p>
&lt;a href="rdp://someserver"&gt;rdp://someserver&lt;/a&gt;
</p></blockquote>
<p>Although the above hyperlink works, I later discovered that Zenoss makes use of TALES expressions, one of which can be substituted for the server name (someserver) in this instance. If you use TALES you would only need to set the hyperlink once globally for all Windows servers by:</p>
<p>1) Navigating to Devices --> Server --> Windows<br />
2) Clicking the zProperties tab<br />
3) Adding the Zenoss TALES hyperlink to the zLinks property</p>
<p>The syntax for the Zenoss TALES hyperlink is:</p>
<blockquote><p>
&lt;a href="rdp://${here/id}"&gt;rdp://${here/id}&lt;/a&gt;
</p></blockquote>
<p>You will then have a clickable hyperlink on the Status tab from within the Windows device (or any new devices you add if you use the Zenoss friendly hyperlink):</p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/02/zenosslinks.png" alt="zenosslinks.png" /></p>
<p>Note: If you are planning to run rdp.bat on Windows Vista or Windows 7 you will need to run it with Administrator privileges. You can do this by right clicking rdp.bat and choosing 'Run as administrator':</p>
<p><img src="http://www.jjclements.co.uk/wp-content/uploads/2010/02/rdpasadmin.png" alt="rdpasadmin.png" /></p>
<p>Download rdp.bat - <a href="http://www.jjclements.co.uk/wp-content/uploads/2010/02/rdp.zip">HERE</a></p>
<p>Note: Since this article I have also written another post on creating <a href="http://www.jjclements.co.uk/2010/03/13/ssh-scp-hyperlink">SSH and SCP Hyperlinks</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjclements.co.uk/2010/02/21/rdp-hyperlink/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Create file of a certain size</title>
		<link>http://www.jjclements.co.uk/2008/10/13/create-file-of-a-certain-size/</link>
		<comments>http://www.jjclements.co.uk/2008/10/13/create-file-of-a-certain-size/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 16:12:54 +0000</pubDate>
		<dc:creator>James Clements</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Windows XP]]></category>
		<category><![CDATA[fsutil.exe]]></category>

		<guid isPermaLink="false">http://www.jjclements.co.uk/?p=105</guid>
		<description><![CDATA[Every now and then I find myself needing to create a file of a certain size for one reason or another. This is usually for testing in situations where people are experiencing email attachment issues or disk quota problems, things like that. The quickest way to do this is to use a Windows command line [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then I find myself needing to create a file of a certain size for one reason or another. This is usually for testing in situations where people are experiencing email attachment issues or disk quota problems, things like that. The quickest way to do this is to use a Windows command line utility called fsutil.exe. This command line tool can be used (amongst other things) for quota management, system info enumeration and some basic file manipulation.</p>
<p><span id="more-105"></span></p>
<p>I recently used the following approach to create a file 5MB in size to prove that email statistics were correctly being generated. This command produces a new file called '5mb-file.txt' on the root of the c:\ drive:</p>
<p>fsutil file createnew C:\5mb-file.txt 5000000</p>
<p>The number at the end of the command is the file size in bytes. So the result is a file just under 5mb in size.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjclements.co.uk/2008/10/13/create-file-of-a-certain-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
