<?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>Nathan's Blog &#187; sysadmin</title>
	<atom:link href="http://nathan.studiodifferent.com/tag/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://nathan.studiodifferent.com</link>
	<description>Wired World Wonderings</description>
	<lastBuildDate>Mon, 22 Oct 2007 16:50:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Classic Windows Scripting</title>
		<link>http://nathan.studiodifferent.com/2007/09/29/classic-windows-scripting/</link>
		<comments>http://nathan.studiodifferent.com/2007/09/29/classic-windows-scripting/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 01:55:29 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://nathan.studiodifferent.com/2007/09/29/classic-windows-scripting/</guid>
		<description><![CDATA[
Before .NET and PowerShell were dreamt of, VBScript and COM objects were the most powerful scripting tools available in a vanilla Windows install. Using Microsoft&#8217;s default facilities is worthwhile because it obviates the need to deploy additional software and cope with that software&#8217;s life cycle and incompatibilities. For instance, a script written for Windows 2000 [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 15px;"><img src="http://nathan.studiodifferent.com/wp-content/uploads/2007/09/script.jpg" alt="ancient script"/></div>
<p>Before .NET and PowerShell were dreamt of, VBScript and COM objects were the most powerful scripting tools available in a vanilla Windows install. Using Microsoft&#8217;s default facilities is worthwhile because it obviates the need to deploy additional software and cope with that software&#8217;s life cycle and incompatibilities. For instance, a script written for Windows 2000 is likely to continue working in Windows Server 2008 x64 Edition. I use PowerShell/.NET for Windows scripting now, but I still regularly use VBScripts which are several years old. Here are several of these simple scripts.<span id="more-104"></span></p>
<h3>Backgrounder</h3>
<p>First, a backgrounder &mdash; VBScript has been installed by default since Windows &#8216;98. The core language is limited, and it relies on objects to perform any actual work. Even file I/O or regular expressions require object creation. Several class libraries exist for more involved tasks, such as e-mail (CDO), XML (Msxml2), and Windows Management (WMI).</p>
<p>Two of the larger class libraries are offered by <a href="http://msdn2.microsoft.com/en-us/library/aa394570.aspx">Windows Management Instrumentation</a> (WMI) and <a href="http://msdn2.microsoft.com/en-us/library/aa772161.aspx">Active Directory Services Integration</a> (ADSI). WMI provides a consistent interface to Windows&#8217; hardware and software configuration, while ADSI manipulates accounts, computers, and other objects in Active Directory. Combined, these facilities can systematically perform the bulk of system administration tasks.</p>
<p><a href="http://nathan.studiodifferent.com/wp-content/uploads/2007/10/studiodifferent-wsf.zip">This zip file</a> contains the following VBScripts to perform simple administrative tasks. They are in the <a href="http://msdn2.microsoft.com/en-us/library/15x4407c.aspx">Windows Scripting File</a> (WSF) format, which is an XML format that encapsulates scripts in XML while adding support for type libraries and limited self-documentation and help facilities. The WMI and ADSI scripts can run locally or on a remote machine.</p>
<div style="text-align: center"><a href="http://nathan.studiodifferent.com/wp-content/uploads/2007/10/studiodifferent-wsf.zip"><img src="http://nathan.studiodifferent.com/wp-content/uploads/2007/09/zipicon.jpg" alt="[Zip Icon]" /></a><br/><a href="http://nathan.studiodifferent.com/wp-content/uploads/2007/10/studiodifferent-wsf.zip">Download WSF Collection</a></div>
<p>The ZIP file includes the following scripts:</p>
<h3>Windows Management Instrumentation (WMI)</h3>
<dl>
<dt><strong>adapt.wsf</strong></dt>
<dd>View or change network configuration, including IP address and<br />
    DNS/WINS servers. Operates locally or remotely. Note that no changes<br />
    take place without the &#8220;/set&#8221; option.</dd>
<dt><strong>rdp.wsf</strong></dt>
<dd>Display, enable, or disable Remote Desktop on a Windows XP computer. Unlike<br />
    the registry edit, this script can remotely enable RDP without a reboot.</dd>
<dt><strong>specs.wsf</strong></dt>
<dd>Display basic tech specs of the passed computer / domain</dd>
<dt><strong>who.wsf</strong></dt>
<dd>Display who is logged in to Windows&#8217; console.</dd>
</dl>
<h3>Active Directory Services Interface (ADSI)</h3>
<dl>
<dt><strong>addtoadmin.wsf</strong></dt>
<dd>Add specified user (/user:userid) to the local administrators group of the<br />
    specified computer(/computer:hostname).</dd>
<dt><strong>openfiles.wsf</strong></dt>
<dd>List files opened through Windows file sharing.</dd>
<dt><strong>user2sid.wsf</strong></dt>
<dd>Print the decimal style SID of an user.</dd>
</dl>
<h3>Other COM Objects</h3>
<dl>
<dt><strong>msxml.wsf</strong></dt>
<dd>Basic XML manipulation: validation, XPath filtering, and XML style sheet<br />
    transformations.</dd>
<dt><strong>wmail.wsf</strong></dt>
<dd>Generate a MIME mail message and send using raw SMTP or place in IIS<br />
    pickup directory.</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://nathan.studiodifferent.com/2007/09/29/classic-windows-scripting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PowerShell: Windows Administration Evolved</title>
		<link>http://nathan.studiodifferent.com/2006/11/15/powershell-windows-administration-evolved/</link>
		<comments>http://nathan.studiodifferent.com/2006/11/15/powershell-windows-administration-evolved/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 06:30:04 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://nathan.studiodifferent.com/2006/11/15/powershell-windows-administration-evolved/</guid>
		<description><![CDATA[


Yesterday Microsoft released their new command shell, Windows PowerShell (via Aaron Tiensivu). This next-generation shell offers an administrative environment that strives to replace a jumble of administrative commands with a consistent, extensible interface.
Consider traditional Windows system administration tools &#8212; it is possible to automate administrative tasks with powerful commands like sc, netsh, and cacls. But [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin-right: 15px;">
<img src="http://nathan.studiodifferent.com/wp-content/uploads/2006/11/powershell-icon.png" alt=""/>
</div>
<p>Yesterday Microsoft <a href="http://blogs.msdn.com/powershell/archive/2006/11/14/windows-powershell-1-0-released.aspx">released</a> their new command shell, Windows PowerShell (via <a href="http://blog.tiensivu.com/aaron/archives/713-PowerShell-1.0-is-supposed-to-RTM-today.html">Aaron Tiensivu</a>). This next-generation shell offers an administrative environment that strives to replace a jumble of administrative commands with a consistent, extensible interface.<span id="more-71"></span></p>
<p>Consider traditional Windows system administration tools &mdash; it is possible to automate administrative tasks with powerful commands like sc, netsh, and cacls. But each of these commands presents an esoteric interface with inconsistent command line options, and built-in documentation is sparse at best. Likewise, scripting with VBScript/JScript has good potential, but interaction with executables requires excessive housekeeping, and COM object interfaces are also inconsistent.</p>
<p>Unlike Windows&#8217; monolithic commands, *nix has long offered a wide range of simple commands whose text input/output is easily strung together to perform useful tasks. Certain command line options are consistent enough (e.g. &#8220;-v&#8221;), and the man/info help system facilitates on-line documentation.</p>
<p>Enter <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx">PowerShell</a>, which evolves *nix pipe concept to process <em>.NET objects</em> rather than simple text. The basic element of PowerShell&#8217;s object-oriented pipeline is the <em>cmdlet</em> (pronounced &#8220;command-let&#8221;). These simple commands follow a <a href="http://msdn2.microsoft.com/en-us/library/ms714428.aspx">verb</a>-noun naming convention that indicates their purpose. For example, <code>Get-Service</code> outputs the services on the local machine as service objects; <code>Set-Date</code> sets the clock. Functionality is so granular that output formatting is isolated to format- cmdlets, and output is the responsibility of output- cmdlets. For example:</p>
<pre>PS C:\&gt; Get-Process notepad | Stop-Process</pre>
<p><code>Get-Process notepad</code> passes a list of .NET process objects named &#8220;notepad&#8221; (specifically, <em><a href="http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.aspx">System.Diagnostics.Process</a></em>), and passes them to <code>Stop-Process</code>, which kills them. It would be just as easy to access any of the other Process properties or methods.</p>
<p>Extensive built-in help is available. The command <code>Get-Help</code> details it&#8217;s own options, and is a good place to start. Combined with the integrated scripting language, PowerShell + .NET is a clean alternative to VBScript/JScript + COM.</p>
<p>PowerShell 1.0 is <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx">available for download</a>. Microsoft&#8217;s <a href="http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/index.mspx">What Can I Do with Windows PowerShell?</a> offers basic examples to get started. I also recommend the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=B4720B00-9A66-430F-BD56-EC48BFCA154F&#038;displaylang=en">documentation pack</a>, which includes a more extensive 32-page Getting Started Guide as well as a 116-page primer. <a href="http://msdn2.microsoft.com/en-us/library/aa830112.aspx">full documentation</a> is available on MSDN.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathan.studiodifferent.com/2006/11/15/powershell-windows-administration-evolved/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Symlinks in Windows</title>
		<link>http://nathan.studiodifferent.com/2006/03/31/a-file-by-any-other-name/</link>
		<comments>http://nathan.studiodifferent.com/2006/03/31/a-file-by-any-other-name/#comments</comments>
		<pubDate>Sat, 01 Apr 2006 04:18:28 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[symlink]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://nathan.studiodifferent.com/2006/03/31/a-file-by-any-other-name/</guid>
		<description><![CDATA[
A:\File\by\Any\Other\Name would smell as sweet&#8230; Symbolic links have been a *NIX staple since the earliest iterations. Windows finally began supporting the concept with NTFS5, introduced in Windows NT4SP4 and included with Windows 2000. Unfortunately Windows built-in toolset is somewhat lacking, and there are a few gotchas.
Hard Link
A hard link is a file system level shortcut. [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin-right: 10px"><img width="140" height="105" src="http://nathan.studiodifferent.com/wp-content/uploads/2006/04/chains.jpg" alt="" /></div>
<p>A:\File\by\Any\Other\Name would smell as sweet&#8230; Symbolic links have been a *NIX staple since the earliest iterations. Windows finally began supporting the concept with NTFS5, introduced in Windows NT4SP4 and included with Windows 2000. Unfortunately Windows built-in toolset is somewhat lacking, and there are a few gotchas.<span id="more-13"></span></p>
<h3>Hard Link</h3>
<p>A <em>hard link</em> is a file system level shortcut. For all intents and purposes, a hard link is no different from any other file. Each hard link, including the original file name is a reference to a single set of underlying data. Edit one file and all of it&#8217;s hard links instantly reflect the change &#8211; likewise, the data remains available until the last remaining hard link is deleted. Hard linking is available for files but not directories. Windows XP and above include the command line utility fsutil, whose usage is straightforward</p>
<pre>fsutil hardlink create c:new.txt c:existingfile.txt</pre>
<p>After this command, c:\new.txt and c:\existing\file.txt are conjoined &#8211; changes made to new.txt are instantaneously reflected in file.txt, and new.txt remains in tact if file.txt is deleted.</p>
<h3>Soft Link</h3>
<p>The Windows-centric term is <em>junction</em> point, but the terms are interchangeable. While a hard link points directly to raw blocks on a disk, a junction point refers to a file name. As such, the junction point does not keep up if the underlying file name changes. The feature is implemented by a file system filter, which transparently redirects I/O as directed by a chunk of data attached to the file. Windows supports junctions only for folders.</p>
<p>Unfortunately, the OS doesn&#8217;t include any mechanism to create them. You can use a command-line tool like Sysinternals&#8217; <a href="http://www.sysinternals.com/Utilities/Junction.html">Junction</a>:</p>
<pre>junction c:newdir x:anexistingdir</pre>
<p>After this command, c:\new\dir will be transparently routed to x:\an\existing\dir. Deleting c:\new\dir\file.txt is synonymous with deleting x:\an\existing\dir\file.txt.</p>
<p>Microsoft&#8217;s fsutil can view junction points, but it cannot create them:</p>
<pre>fsutil reparsepoint query c:newdir</pre>
<p>As with a *NIX soft link, be aware that any actions you take underneath the junction point directly affect the contained files. It is safe to delete the junction point itself, but <strong style="color: red">be careful not to SHIFT-delete a junction point or it&#8217;s parents &#8211; this will delete the files in the actual directory</strong>. Ironically, deletes using the Recycle Bin or rmdir /s do not recurse into junction points.</p>
<h3>GUI</h3>
<p>When looking for a GUI, I came across <a href="http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html">Link Shell Extension</a> via <a href="http://coolthingoftheday.blogspot.com/2006/03/explorer-shell-extension-to-create-and.html">Greg&#8217;s Cool [Utility] of the day</a>. This handy utility adds a chain icon to junction points in Explorer, and allows for the creation of both hard links and junction points. The stateful context menu uses familiar copy-and-paste semantics.</p>
<p><strong>Update:</strong> I just installed <a href="http://alax.info/blog/ntfslinks/">NTFS Links</a>. This utility adds &#8220;Create Soft Link Here&#8221; to a drag-and-drop with the alternate button, hooks Windows copy-and-paste with a dialogue box prompting to paste a soft/hard link, and more. Neat stuff!</p>
]]></content:encoded>
			<wfw:commentRss>http://nathan.studiodifferent.com/2006/03/31/a-file-by-any-other-name/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
