<?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>Andrew Morgan &#187; script</title>
	<atom:link href="http://andrewmorgan.ie/tag/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewmorgan.ie</link>
	<description>Grumpy ramblings</description>
	<lastBuildDate>Fri, 30 Jun 2017 09:24:25 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0</generator>
	<item>
		<title>Enabling RDP on a server remotely.</title>
		<link>http://andrewmorgan.ie/2009/09/enabling-rdp-on-a-server-remotely/</link>
		<comments>http://andrewmorgan.ie/2009/09/enabling-rdp-on-a-server-remotely/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 09:23:56 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=260</guid>
		<description><![CDATA[There&#8217;s very little more annoying in a windows environment than having to go to a console of a server because some idiot has disabled remote administration on a server 2003/2000 server. I was in this situation recently and decided not to go to the console out of principle. I wrote the following program in order to get around this issue. Its called RDPon.exe and you can get it here: With this you can: Query RDP status Enable RDP Disable RDP [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>There&#8217;s <strong>very</strong> little more annoying in a windows environment than having to go to a console of a server because some idiot has disabled remote administration on a server 2003/2000 server. I was in this situation recently and decided not to go to the console out of principle.</p>
<p><img class="aligncenter size-full wp-image-261" title="rdpon" src="/wp-content/uploads/2009/09/rdpon.jpg" alt="rdpon" width="495" height="244" /></p>
<p>I wrote the following program in order to get around this issue. Its called RDPon.exe and you can get it <a href="https://www.box.com/s/b420e28c5ae57ced2fd9" target="_blank">here: </a></p>
<p>With this you can:</p>
<ul>
<li>Query RDP status</li>
<li>Enable RDP</li>
<li>Disable RDP</li>
</ul>
<p>I have sealed it as an exe so that you can right click it and choose run as to get at your admin account easily.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2009/09/enabling-rdp-on-a-server-remotely/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove shell extensions after installing Adobe Acrobat</title>
		<link>http://andrewmorgan.ie/2009/01/remove-combine-supported-files-in-acrobat-after-installing-acrobat-8/</link>
		<comments>http://andrewmorgan.ie/2009/01/remove-combine-supported-files-in-acrobat-after-installing-acrobat-8/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 16:41:04 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Server Based Computing]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XenApp]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Context Menu]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=235</guid>
		<description><![CDATA[A pet peeve of mine are context menu extensions&#8230; Why software vendors decide to include non optional context menu addons are besides me! A good example of this would be Adobe. when right clicking  on an office document Adobe decided  &#8220;Combine supported files in acrobat&#8221; to be we all must have, fine in the wild&#8230; but not so good in a shared desktop environment. To remove this from your Citrix environment / Desktop simply run this command: REGSVR32 /u "C:Program [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><img class="alignright wp-image-942 " title="Adobe_Air_Logo" src="http://andrewmorgan.ie/wp-content/uploads/2011/10/adobe_air_logo.jpg" alt="" width="107" height="107" />A pet peeve of mine are context menu extensions&#8230; Why software vendors decide to include non optional context menu addons are besides me! A good example of this would be Adobe.</p>
<p>when right clicking  on an office document Adobe decided  &#8220;Combine supported files in acrobat&#8221; to be we all must have, fine in the wild&#8230; but not so good in a shared desktop environment.</p>
<p>To remove this from your Citrix environment / Desktop simply run this command:</p>
<pre>REGSVR32 /u "C:Program FilesAdobeAcrobat 9.0Acrobat ElementsContextMenu.dll.</pre>
<p>If you also wish to remove the New &gt; file type associations that Adobe decide to push in, heres a script to do so:</p>
<pre>REG DELETE HKEY_CLASSES_ROOT.xdpAcroExch.XDPDocShellNew /f
 REG DELETE HKEY_CLASSES_ROOT.xdpShellNew /f</pre>
<h4>Update:</h4>
<p>With the move to 64 bit platforms, a new dll has been put in place:</p>
<p>C:Program Files (x86)AdobeAcrobat 9.0Acrobat Elementscontextmenu64.dll</p>
<p>This dll add&#8217;s the following items to the context menu:</p>
<ul>
<li>Convert to Adobe PDF</li>
<li>Convert to Adobe PDF and Email.</li>
</ul>
<p>If you wish to remove these, run the following command:</p>
<pre>REGSVR32 /u "C:Program Files (x86)AdobeAcrobat 9.0Acrobat ElementsContextMenu64.dll"</pre>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2009/01/remove-combine-supported-files-in-acrobat-after-installing-acrobat-8/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Scripting Web interface 5.0 installation.</title>
		<link>http://andrewmorgan.ie/2009/01/scripting-web-interface-50-installation/</link>
		<comments>http://andrewmorgan.ie/2009/01/scripting-web-interface-50-installation/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 19:41:38 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Web Interface]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=186</guid>
		<description><![CDATA[To auto install web interface sites, sitemgr.exe must be used. the below script will create a default website for XenApp services and will also create a PNAgent site. The pre Requisits for this script are: ·         Installation of IIS 6.0 + ·         Installation of .net framework 3.5 ·         Installation of J# ·         Installation of Citrix access management console framework (and web interface component). ·         Installation of citrix web interface. Configure your variables for the management servers and farm names, then [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>To auto install web interface sites, sitemgr.exe must be <img class="alignright size-thumbnail wp-image-187" title="ctxapp12" src="/wp-content/uploads/2009/01/ctxapp12.png?w=96" alt="ctxapp12" width="96" height="96" />used. the below script will create a default website for XenApp services and will also create a PNAgent site.</p>
<p>The pre Requisits for this script are:</p>
<p class="MsoListParagraphCxSpFirst" style="text-indent:-18pt;margin:0 0 0 36pt;"><span style="font-size:10pt;color:black;line-height:115%;font-family:Symbol;">·<span style="font:7pt &quot;">         </span></span><span style="font-size:10pt;color:black;line-height:115%;font-family:&quot;">Installation of IIS 6.0 +</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent:-18pt;margin:0 0 0 36pt;"><span style="font-size:10pt;color:black;line-height:115%;font-family:Symbol;">·<span style="font:7pt &quot;">         </span></span><span style="font-size:10pt;color:black;line-height:115%;font-family:&quot;">Installation of .net framework 3.5</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent:-18pt;margin:0 0 0 36pt;"><span style="font-size:10pt;color:black;line-height:115%;font-family:Symbol;">·<span style="font:7pt &quot;">         </span></span><span style="font-size:10pt;color:black;line-height:115%;font-family:&quot;">Installation of J#</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent:-18pt;margin:0 0 0 36pt;"><span style="font-size:10pt;color:black;line-height:115%;font-family:Symbol;">·<span style="font:7pt &quot;">         </span></span><span style="font-size:10pt;color:black;line-height:115%;font-family:&quot;">Installation of Citrix access management console framework (and web interface component).</span></p>
<p class="MsoListParagraphCxSpLast" style="text-indent:-18pt;margin:0 0 10pt 36pt;"><span style="font-size:10pt;color:black;line-height:115%;font-family:Symbol;">·<span style="font:7pt &quot;">         </span></span><span style="font-size:10pt;color:black;line-height:115%;font-family:&quot;">Installation of citrix web interface.</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;">
<p>Configure your variables for the management servers and farm names, then save the below as a batch file:</p>
<p style="padding-left:30px;">set sitemgrdir=C:Program FilesCitrixWeb Interface5.0.1<br />
set mgmtservers=server0001;server0002<br />
set farmname=farm01</p>
<p style="padding-left:30px;">&#8220;%sitemgrdir%&#8221;sitemgr.exe -c &#8220;WIDest=1:/Citrix/XenApp,Config=local,XMLService=%mgmtservers%,farmname=%farmname%,XMLSPort=80,WIDefaultSite=yes&#8221;&#8216;)/?<br />
&#8220;%sitemgrdir%&#8221;sitemgr.exe -c &#8220;PNADest=1:/Citrix/PNAgent,Config=local,XMLService=%mgmtservers%,farmname=%farmname%,XMLSPort=80&#8243;&#8216;)/?</p>
<p>The script in full can be downloaded <a href="http://www.4shared.com/file/78497085/db35a352/webinterfaceinstall.html" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2009/01/scripting-web-interface-50-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do you move a computer automatically from one OU to another using a script?</title>
		<link>http://andrewmorgan.ie/2008/12/how-do-you-move-a-computer-automatically-from-one-ou-to-another-using-a-script/</link>
		<comments>http://andrewmorgan.ie/2008/12/how-do-you-move-a-computer-automatically-from-one-ou-to-another-using-a-script/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 19:30:04 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Enteo]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=175</guid>
		<description><![CDATA[I was asked the following question recently when finishing our Citrix server deployment method. We needed a script that would run on a computer as part of a sequence of scripts that would move a server from its current OU to the servers final resting place a terminal servers OU. The below script achieved what we needed by using the computers %computername% variable to move the computer. In our case the following apply: ·The computers name is using the variable [&#8230;]]]></description>
				<content:encoded><![CDATA[<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;"><img class="alignright" src="/wp-content/uploads/2008/07/images.jpg?w=144&amp;h=108&amp;h=108" alt="" width="144" height="108" />I was asked the following question recently when finishing our Citrix server deployment method.</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">We needed a script that would run on a computer as part of a sequence of scripts that would move a server from its current OU to the servers final resting place a terminal servers OU.</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">The below script achieved what we needed by using the computers %computername% variable to move the computer.</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">In our case the following apply:</span></p>
<p class="MsoListParagraphCxSpFirst" style="text-indent:-18pt;margin:0 0 0 36pt;"><span style="font-family:Symbol;"><span style="font-size:small;">·</span></span><span style="font-size:small;font-family:Calibri;">The computers name is using the variable %computername%</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent:-18pt;margin:0 0 0 36pt;"><span style="font-family:Symbol;"><span style="font-size:small;">·</span></span><span style="font-size:small;"><span style="font-family:Calibri;">The domain is <strong>domain.net</strong></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent:-18pt;margin:0 0 0 36pt;"><span style="font-family:Symbol;"><span style="font-size:small;">·</span></span><span style="font-size:small;"><span style="font-family:Calibri;">The computers OU before the move is <strong>computers</strong></span></span></p>
<p class="MsoListParagraphCxSpLast" style="text-indent:-18pt;margin:0 0 10pt 36pt;"><span style="font-family:Symbol;"><span style="font-size:small;">·</span></span><span style="font-size:small;"><span style="font-family:Calibri;">The OU we wish to move to is <strong>Terminal Servers</strong></span></span></p>
<p class="MsoNormal" style="margin:0 0 10pt 18pt;"><span style="font-size:small;font-family:Calibri;">dsmove &#8220;CN=%computername%,OU=computers,DC=domain,DC=net&#8221; -d domain.net -newparent OU=&#8221;Terminal Servers&#8221;,DC=domain,DC=net</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">if you are unaware of the computers current OU before the move and you still wish to script the move, the <a href="http://forums.techarena.in/active-directory/356088.htm" target="_blank">following</a> forum post will get you in the right direction. </span></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/12/how-do-you-move-a-computer-automatically-from-one-ou-to-another-using-a-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enteo: The 10 minute rule on batch files.</title>
		<link>http://andrewmorgan.ie/2008/11/enteo-the-10-minute-rule-on-batch-files/</link>
		<comments>http://andrewmorgan.ie/2008/11/enteo-the-10-minute-rule-on-batch-files/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 11:06:00 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Enteo]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=152</guid>
		<description><![CDATA[Heres a tricky problem with Enteo, When executing a batch file enteo only gives a batch file 10 minutes to complete before moving on. Generally speaking this is no problem as how many batch files do you run take over 10 minutes? This problem came to light for us when enteo began causing our ESX servers to purple screen of death during the pe stage of the build, which resulted in us moving our virtual servers to a stable ESX [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="text-align:left;"><img class="alignright" src="/wp-content/uploads/2008/10/zeichen_typ_data_22.gif?w=32&amp;h=32" alt="" width="32" height="32" />Heres a tricky problem with Enteo, When executing a batch file enteo only gives a batch file 10 minutes to complete before moving on.</p>
<p style="text-align:left;">Generally speaking this is no problem as how many batch files do you run take over 10 minutes?</p>
<p style="text-align:left;">This problem came to light for us when enteo began causing our ESX servers to purple screen of death during the pe stage of the build, which resulted in us moving our virtual servers to a stable ESX while we rebuilt. The problem was that the ESX was so slow with all the added servers that our scripted citrix updates were taking over 10 minutes, the script continued, rebooted the server during the updates and low and behold a very sick citrix server.</p>
<p style="text-align:left;">The trick to get around this, and i recommend this for any batch file you run in enteo, is to create a looping if statement in the enteo script to check for a registry key. Once you have this key created run your updates then delete the key as the last line in your batch file. This will cause enteo to loop even after the 10 minutes leaving your critical updates to install without fear of being.</p>
<p style="text-align:left;">heres the idea for the enteo script:</p>
<p style="text-align:left;padding-left:30px;">execute %systemdrive%longbatchfile.bat /?<br />
:check<br />
if exist regkey goto sleep<br />
del %systemdrive%longbatchfile<br />
Exitproc<br />
:sleep<br />
sleep 60<br />
goto check</p>
<p style="text-align:left;padding-left:30px;">And in the batchfile create the reg key, do your work then delete it:</p>
<p style="text-align:left;padding-left:30px;">reg add hklmsoftwareenteo /v checkkey<br />
update1<br />
update2<br />
update3<br />
update4<br />
update5<br />
reg delete hklmsoftwareenteo /v checkkey</p>
<p style="text-align:left;">what will happen is simple, even if the script times out, the script will carry on sleeping until the key is deleted, no matter how long it takes.</p>
<p style="text-align:left;">After the jump is an example of my code so you can see what we did to get around this <img src="http://andrewmorgan.ie/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p style="text-align:left;"><span id="more-152"></span></p>
<p style="text-align:left;">Enteo EScript:</p>
<p style="text-align:left;padding-left:30px;">Copy(&#8216;.Extern$*.*&#8217;,&#8217;%windir%TempHotfix&#8217;)/TW<br />
Execute(&#8216;%windir%temphotfixhotfix_install.bat&#8217;)/?<br />
: Check<br />
If RegValueExists(&#8216;HKEY_LOCAL_MACHINESOFTWAREEnteo&#8217;,&#8217;rebootstatus&#8217;)<br />
goto Sleep<br />
Delete(&#8216;%windir%temphotfix*.*&#8217;)<br />
RemoveDir(&#8216;%windir%temphotfix&#8217;)/S/TW<br />
Execute(&#8216;%WINSYSDIR%shutdown.exe /r /t 30&#8242;)<br />
ExitProc(Done)<br />
: Sleep<br />
Sleep(&#8217;60&#8217;)<br />
goto Check</p>
<p style="text-align:left;">Batch file:</p>
<p style="text-align:left;padding-left:30px;">Rem Adding check registry key<br />
Reg add &#8220;HKEY_LOCAL_MACHINESOFTWAREEnteo&#8221; /v rebootstatus /t REG_SZ /d &#8220;0&#8221; /f<br />
msiexec /p %windir%temphotfixPSE450W2K3R02.msp /qn /norestart<br />
msiexec /p %windir%temphotfixPSE450R02W2K3002.msp /qn /norestart<br />
msiexec /p %windir%temphotfixPSE450R02W2K3004.msp /qn /norestart<br />
msiexec /p %windir%temphotfixPSE450R02W2K3007.msp /qn /norestart<br />
msiexec /p %windir%temphotfixPSE450R02W2K3008.msp /qn /norestart<br />
msiexec /p %windir%temphotfixPSE450R02W2K3010.msp /qn /norestart<br />
msiexec /p %windir%temphotfixPSE450R02W2K3014.msp /qn /norestart<br />
msiexec /p %windir%temphotfixPSE450R02W2K3036.msp /qn /norestart<br />
msiexec /p %windir%temphotfixPSE450R02W2K3037.msp /qn /norestart<br />
Rem Clearing check registry key<br />
reg delete HKEY_LOCAL_MACHINESOFTWAREEnteo /v rebootstatus /f</p>
<p style="text-align:left;">as with the above, the batch file controlling when the reg key is created and deleted determines when the script is allowed to end, regardless of enteo&#8217;s 10 minute rule.</p>
<p style="text-align:left;">
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/11/enteo-the-10-minute-rule-on-batch-files/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A simple, but effective, annoyance.</title>
		<link>http://andrewmorgan.ie/2008/10/a-simple-but-effective-annoyance/</link>
		<comments>http://andrewmorgan.ie/2008/10/a-simple-but-effective-annoyance/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 15:02:36 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=156</guid>
		<description><![CDATA[heres a funny one for you scripters out there, we had a chat in work a few weeks ago about just how effective scripting is and whether it is actually useful. taking massive offense to this, i ofcourse decided to show said moaner just how effective batch files are! Heres an evil one for you: :starting start cmd goto starting Thats it! watching moaners pc crease and die when i executed this in his session using psexec was my entertainment [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>h<img class="alignright" src="/wp-content/uploads/2008/07/images.jpg?w=144&amp;h=108&amp;h=108" alt="" width="144" height="108" />eres a funny one for you scripters out there, we had a chat in work a few weeks ago about just how effective scripting is and whether it is actually useful.</p>
<p>taking massive offense to this, i ofcourse decided to show said moaner just how effective batch files are!</p>
<p>Heres an evil one for you:</p>
<p style="padding-left:30px;">:starting</p>
<p style="padding-left:30px;">start cmd</p>
<p style="padding-left:30px;">goto starting</p>
<p>Thats it! watching moaners pc crease and die when i executed this in his session using psexec was my entertainment for the week.</p>
<p>And before you start emailing me, dont ask how i got it into his session. psexec.exe /?</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/10/a-simple-but-effective-annoyance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Administration Automation Part 1:</title>
		<link>http://andrewmorgan.ie/2008/09/server-build-automation-part-1/</link>
		<comments>http://andrewmorgan.ie/2008/09/server-build-automation-part-1/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 21:07:20 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[users]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=119</guid>
		<description><![CDATA[Every company has there build specs, their dummy accounts, after installation software and other internal doo dad&#8217;s they feel are vital to the build. Even with imaging you can never guarantee its all done right so i always prefer to script the end of install just to make sure its clean, fresh and right each time a system comes off the build line. Heres a few pointers i threw together to get your &#8220;post build&#8221; script in order starting with [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><img class="alignright" src="/wp-content/uploads/2008/07/images.jpg?w=144&amp;h=108&amp;h=108" alt="" width="144" height="108" />Every company has there build specs, their dummy accounts, after installation software and other internal doo dad&#8217;s they feel are vital to the build. Even with imaging you can never guarantee its all done right so i always prefer to script the end of install just to make sure its clean, fresh and right each time a system comes off the build line.</p>
<p>Heres a few pointers i threw together to get your &#8220;post build&#8221; script in order starting with dummy accounts, passwords and user memberships.</p>
<p><strong>Renaming the administrators account (admrename.vbs):</strong></p>
<p style="padding-left:30px;">strComputer = &#8220;.&#8221;<br />
Set wshShell = WScript.CreateObject( &#8220;WScript.Shell&#8221; )<br />
strComputerName = wshShell.ExpandEnvironmentStrings( &#8220;%COMPUTERNAME%&#8221; )</p>
<p>Const ADS_UF_DONT_EXPIRE_PASSWD = &amp;H10000</p>
<p>Set objWMIService = GetObject(&#8220;winmgmts:&#8221; &amp; strComputer &amp; &#8220;rootcimv2&#8243;)<br />
Set colAccounts = objWMIService.ExecQuery _<br />
(&#8220;Select * From Win32_UserAccount Where LocalAccount = True And Name = &#8216;Administrator'&#8221;)</p>
<p>For Each objAccount in colAccounts<br />
objAccount.Rename &#8220;ADM&#8221; &amp; <strong>strComputerName</strong></p>
<p>The above script will rename the Administrator account to ADMcomputername, it can easily be changed to a static name deleting the &amp; <strong>strComputerName </strong>and adding the full name in the &#8220;&#8221; &#8216;s.</p>
<p><strong>Creating a local account using the command line (batch):</strong></p>
<p style="padding-left:30px;">net user<strong> patchacc passw0rd </strong>/add /comment:&#8221;Patch account&#8221; /fullname:&#8221;windows Patch account&#8221; /active:yes /passwordchg:no /passwordreq:yes</p>
<p>the above script will create a username (patchacc) with password (passw0rd), the account will also be enabled.</p>
<p><strong>Add an account to the local administrators(batch):</strong></p>
<p style="padding-left:30px;">net localgroup /add administrators patchacc</p>
<p>The above command adds the username patchacc to the local group administrators, you can use the above command to add a domain account using net localgroup /add administrators domainusername.</p>
<p><strong>Setting a password to never expire (pwd.vbs):</strong></p>
<p style="padding-left:30px;">Set objUser = GetObject(&#8220;WinNT://&#8221; &amp; strcomputer &amp; &#8220;/<strong>username</strong>&#8220;)<br />
objPasswordNoChangeFlag = objUser.UserFlags XOR ADS_UF_DONT_EXPIRE_PASSWD<br />
objUser.Put &#8220;userFlags&#8221;, objPasswordNoChangeFlag<br />
objUser.SetInfo</p>
<p>The above scriptlet will simply set the password to the &#8220;username&#8221; account to never expire, dont try to do it with net user, it doesnt work&#8230; ever.</p>
<p><strong>Creating a dummy administrator account:</strong></p>
<p style="padding-left:30px;">net user <strong>Administrator Notreal123 </strong>/add /comment:&#8221;Bogus Admin Account&#8221; /fullname:&#8221;Bogus Admin Account&#8221; /active:no /passwordchg:no /passwordreq:yes</p>
<p>The above script will create a disabled user called administrator (rename the current administrator first), with password of Notreal123.</p>
<p>After the jump is an example of how to tie them all into one super script and the source files.</p>
<p><a href="http://www.4shared.com/file/64993533/ef9ff324/users.html" target="_blank">http://www.4shared.com/file/64993533/ef9ff324/users.html</a></p>
<p><span id="more-119"></span></p>
<p>REM copy the entire cotents of the zip to a share name on your network, add the share to the below statement.<br />
set netdir=servernameshare</p>
<p>@echo Creating Patch account &amp; net user patchacc passw0rd /add /comment:&#8221;Patch account&#8221; /fullname:&#8221;windows Patch account&#8221; /active:yes /passwordchg:no /passwordreq:yes<br />
@echo.<br />
@echo Renaming admin account &amp; cscript /b &#8220;%netdir%admrename.vbs&#8221; &amp; echo Complete<br />
@echo.<br />
@echo Fixing password &amp; cscript /b &#8220;%netdir%pwd.vbs&#8221; &amp; echo Complete<br />
@echo.<br />
@echo Adding Dummy account &amp; et user Administrator Notreal123 /add /comment:&#8221;Bogus Admin Account&#8221; /fullname:&#8221;Bogus Admin Account&#8221; /active:no /passwordchg:no /passwordreq:yes<br />
@echo.<br />
@echo adding patch to local admins. &amp; net localgroup /add administrators patchacc</p>
<p>pause</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/09/server-build-automation-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to monitor a server reboot</title>
		<link>http://andrewmorgan.ie/2008/09/how-to-monitor-a-server-reboot/</link>
		<comments>http://andrewmorgan.ie/2008/09/how-to-monitor-a-server-reboot/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 20:19:42 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=116</guid>
		<description><![CDATA[Often when restarting a server its nice to get a complete timeline of when the server went down and subsequently comes back up. I found this script a while back but found it lacked the later port 3389 to enable remote desktop again. I editted the following script from eric and have been using it for a very long time now. http://www.ericwoodford.com/use_ping_to_notify_when_server_reboots I have modified it slightly to include a program called portqry, when a server is restarted it monitors [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="/wp-content/uploads/2008/09/serverrebootstall.jpg"><img class="size-thumbnail wp-image-117 alignright" title="serverrebootstall" src="/wp-content/uploads/2008/09/serverrebootstall.jpg?w=128" alt="" width="128" height="96" /></a></p>
<p>Often when restarting a server its nice to get a complete timeline of when the server went down and subsequently comes back up. I found this script a while back but found it lacked the later port 3389 to enable remote desktop again. I editted the following script from eric and have been using it for a very long time now.</p>
<p>http://www.ericwoodford.com/use_ping_to_notify_when_server_reboots</p>
<p>I have modified it slightly to include a program called portqry, when a server is restarted it monitors ping responses until the server goes down. It then continually pings the server until it gets a response. Once a responce on icmp is received it will query port 3389 (remote desktop) until it gets a response indicating the server is now ready to be logged into again.</p>
<p>you can either type rebooter &#8220;servername&#8221; or simply type rebooter and the program will ask you for the servers name.</p>
<p>After the jump is the code, and the zip file i have uploaded packaging it all together.</p>
<p><span id="more-116"></span></p>
<p>The script is available here with all the neccessary batches/programs, best to extract them to your %windir%system32 where they can be accessed from cmd.</p>
<p>http://www.4shared.com/file/64988601/c29bd123/rebooter.html</p>
<pre>echo off
 CLS
 Set A=0
 Set ServerName=%1
if not '%1'=='' goto :Pass1
 Set /p ServerName=[What is the server name?]
 if not '%ServerName%'=='' goto :Pass1
 echo Failed to get Server name..
 Goto :End
:Pass1
 Title Checking %servername%
 Echo Checking Server %ServerName% for response
 echo Check # _
 :Pass1a
 ping %ServerName% &gt; %servername%-results.txt
 find /C "Request timed out" %servername%-results.txt &gt; %servername%-fresults.txt
for /F "skip=1 tokens=1,2 delims=:" %%a in (%servername%-fresults.txt) DO (
 if NOT "%%b"==" 0" goto :TimedOut
 cls
 Echo Checking Server %ServerName% for response
 echo Check # %A%
 Set /A A+=1
 Goto :Pass1a
 )
 :TimedOut
 Set DownTime=%TIME%
 Title %servername% DOWN
 Echo Server Down %DownTIME% Passes: %A%
 Set B=0
 :Pass2
 ping %ServerName% &gt; %servername%-results.txt
 find /C "Request timed out" %servername%-results.txt &gt; %servername%-fresults.txt
 for /F "skip=1 tokens=1,2 delims=:" %%a in (%servername%-fresults.txt) DO (
 if "%%b"==" 0" set uptime=%time% &amp; set c=0 &amp; goto :BackUp
 CLS
 Echo Checking Server %ServerName% for response
 echo Check # %A% - Server Down: %DownTime%
 Echo Waiting For Server to come up: %B%
 Set /A B+=1
 Goto :Pass2
 )
:BackUp
 Title %servername% Pinging
 cls
 Echo Checking Server %ServerName% for response
 echo Check # %A% - Server Down: %DownTime%
 echo Server Pinging Again: %uptime% - Passes: %B%
 Echo Checking rdp port:
 portqry -n %servername% -q -e 3389
 Set /A C+=1
 if %errorlevel% NEQ 0 goto :backup
 del %servername%-fresults.txt
 del %servername%-results.txt
 cls
 Title %servername% UP
 Echo Checking Server %ServerName% for response
 echo Check # %A% - Server Down: %DownTime%
 echo Server Pinging Again: %uptime% - Passes: %B%
 echo RDP available @ %time% - Passes: %C%
 @echo.
 Echo Server down @ %downtime% Service restored @ %time%
 pause
 :End</pre>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/09/how-to-monitor-a-server-reboot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do i remove the language bar? (Updated)</title>
		<link>http://andrewmorgan.ie/2008/07/how-do-i-remove-the-language-bar/</link>
		<comments>http://andrewmorgan.ie/2008/07/how-do-i-remove-the-language-bar/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 06:28:07 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Remote Desktop Services (RDS)]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Server Based Computing]]></category>
		<category><![CDATA[Virtual Desktop Infrastructure]]></category>
		<category><![CDATA[XenApp]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=71</guid>
		<description><![CDATA[The language bar, as handy as Microsoft think it is can cause real hassle in terminal services or Citrix sessions. Seeing a language bar for each opened application is both annoying and confusing&#8230; and well lets face it, how do often you actually use it? As the language bar is part on the office installation, i did not want to go fiddling with the installation properties incase it knocked anything else in the office install out of sync but i [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><img class="alignright" src="/wp-content/uploads/2008/07/images.jpg?w=144&amp;h=108" alt="" width="144" height="108" />The language bar, as handy as Microsoft think it is can cause real hassle in terminal services or Citrix sessions. Seeing a language bar for each opened application is both annoying and confusing&#8230; and well lets face it, how do often you actually use it?</p>
<p>As the language bar is part on the office installation, i did not want to go fiddling with the installation properties incase it knocked anything else in the office install out of sync but i did need to remove it from 70+ citrix servers without much overhead.</p>
<p>I read an article recently on the citrix forums and it suggested that ctfmon.exe was the owner of the language bar, once i knew this i wrote a script to deny users access to this file, which in turn would block from running.</p>
<p>I decided to use <a href="http://support.microsoft.com/kb/318754" target="_blank">xcacls</a> as a command line utility, i used xcacls to straight out deny members of the users group (locally) to access the file, this is done like this:</p>
<p><strong>xcacls.exe C:windowssystem32ctfmon.exe /E /d users /Y</strong></p>
<p>if you are using windows 2000, you can copy the xcacls.exe to an network share and run it from there without any issue.</p>
<p><strong>serversharexcacls.exe %SystemRoot%system32ctfmon.exe /E /d users /Y</strong></p>
<p>and if you want to hit 60+ servers remotely, use psexec</p>
<p><strong>psexec @servers.txt -u domainusername cmd /c &#8220;servernamectxutilsxcacls.exe %SystemRoot%system32ctfmon.exe /E /d users /Y&#8221;</strong></p>
<p>Servers.txt would be in the same directory as psexec, and would contain the server names one per line.</p>
<p>I&#8217;ve uploaded the script <a href="http://www.4shared.com/file/55640127/c56b7b7d/language_bar_disable.html">here</a>:</p>
<h2><strong>Update:</strong></h2>
<p>As of server 2008 / windows vista the above fix no longer works, this is due to the language bar being heavily integrated.</p>
<p>The following key controls the language bar in these operating systems:</p>
<p>HKEY_CURRENT_USERSoftwareMicrosoftCTFLangBar</p>
<p>Showstatus (DWORD).</p>
<p><img class="alignright wp-image-558 size-full" title="langbar" src="http://andrewmorgan.ie/wp-content/uploads/2011/08/langbar.png" alt="" width="719" height="205" /></p>
<p>To hide the language bar, set the value of showstatus to 3.</p>
<p>This can be done using a mandatory profile or group policy as below:</p>
<p><img class="alignright wp-image-568 size-full" title="Group policy" src="http://andrewmorgan.ie/wp-content/uploads/2011/08/group-policy1.png" alt="" width="1025" height="216" /></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/07/how-do-i-remove-the-language-bar/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>List Members (and email addresses) of an Active Directory group.</title>
		<link>http://andrewmorgan.ie/2008/07/list-members-and-email-addresses-of-an-active-directory-group/</link>
		<comments>http://andrewmorgan.ie/2008/07/list-members-and-email-addresses-of-an-active-directory-group/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 09:09:16 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=51</guid>
		<description><![CDATA[Recently i was asked to list a: all members of an active directory group, and b: pull their primary email address, leaving me with an end report of username and primary email address. I used dsget to pull the user information from the group, below is the command i used: dsget group &#8220;cn=Groupname,ou=DLs,ou=Exchange Recipients,dc=ie,dc=domain,dc=company,dc=com&#8221; -members &#62;&#62; 1.txt the above command enumerates the &#8220;groupname&#8221; group in an ou called dls, in an ou called exchange recipients in the domain ie.domain.company.com. if [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="text-align:left;"><img class="alignright" src="/wp-content/uploads/2008/07/images.jpg" alt="" width="144" height="108" />Recently i was asked to list a: all members of an active directory group, and b: pull their primary email address, leaving me with an end report of username and primary email address.</p>
<p>I used <a href="http://technet2.microsoft.com/windowsserver/en/library/96a4a5ee-ee72-44d5-845f-71b2de33d4411033.mspx?mfr=true" target="_blank">dsget</a> to pull the user information from the group, below is the command i used:</p>
<p style="text-align:left;"><strong>dsget group &#8220;cn=Groupname,ou=DLs,ou=Exchange Recipients,dc=ie,dc=domain,dc=company,dc=com&#8221; -members &gt;&gt; 1.txt</strong></p>
<p>the above command enumerates the &#8220;groupname&#8221; group in an ou called dls, in an ou called exchange recipients in the domain ie.domain.company.com. if your ou or domain structure is different trim out (or add) what you need.  The -members at the end of the file will dump only the usernames in FQDN format.</p>
<p>Once the script is run check the current directory for a textfile called 1.txt.  This text file will contain the usernames you need in FQDN format like below:</p>
<p>&#8220;CN=Tom Thumb (IE),ou=Dublin,dc=ie,dc=domain,dc=company,dc=com&#8221;<br />
&#8220;CN=Mike Hunt (IE),ou=Dublin,dc=ie,dc=domain,dc=company,dc=com&#8221;</p>
<p>In order to get the email address&#8217;es i decided not to try and read from the file, instead i just ran the same command again and piped the results to another dsget query.</p>
<p><strong>dsget group &#8220;cn=Groupname,ou=DLs,ou=Exchange Recipients,dc=ie,dc=domain,dc=company,dc=com&#8221; -members | dsget user -email &gt;&gt; 2.txt</strong></p>
<p>The above will pull the results we saw in 1.txt, but instead it passes it straight into another query (dsget user -email) and sends those results to a text file. 2.txt should contain the users primary email address:</p>
<p>tom.thumb@company.com<br />
mike.hunt@company.ie</p>
<p>Now simply copy the contents on both text files into neighboring columns in excel and you have your report <img src="http://andrewmorgan.ie/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p><strong>Update: 13/08/2012</strong></p>
<p>An old friend of mine Rob reminded me that this post existed and wondered how to do it with powershell. Luckily This is much, much easier to do with Windows Powershell!</p>
<p>On a server with the active directory module for powershell installed (normally a domain controller), run the following commands: (replace the group name with your own one).</p>
<p>&nbsp;</p>
<p>[sourcecode language=&#8221;PowerShell&#8221;]</p>
<p>#######Change the below values#######<br />
$groupname = &quot;My Group Name&quot;<br />
$exportfile = c:tempreport.csv<br />
#####################################</p>
<p>if (!(get-module -ListAvailable | where {$_.name -eq &quot;ActiveDirectory1&quot;} -ea 0)){<br />
        write-warning &quot;The ActiveDirectory PowerShell module is Not Installed!&quot;<br />
        break}<br />
else{<br />
        write-host &quot;Importing Active directory module&quot;;import-module activedirectory -ea 0<br />
        Get-ADGroupmember $groupname | %{get-aduser $_.samaccountname -properties cn,samaccountname,emailaddress | select cn,samaccountname,emailaddress | export-csv -notypeinformation $exportfile}<br />
}<br />
[/sourcecode]</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/07/list-members-and-email-addresses-of-an-active-directory-group/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
