<?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>Wayne Zimmerman&#039;s Blog &#187; Domain</title>
	<atom:link href="http://www.waynezim.com/tag/domain/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.waynezim.com</link>
	<description>My World of Tech, Life and Anything Else</description>
	<lastBuildDate>Sun, 05 Feb 2012 05:35:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to Set Permission on a Service Using Subinacl</title>
		<link>http://www.waynezim.com/2010/02/how-to-set-permission-on-a-service-using-subinacl/</link>
		<comments>http://www.waynezim.com/2010/02/how-to-set-permission-on-a-service-using-subinacl/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 20:00:48 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Permissions]]></category>
		<category><![CDATA[Registry]]></category>
		<category><![CDATA[Remote Administration]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Service]]></category>
		<category><![CDATA[subinacl]]></category>
		<category><![CDATA[subinacl.exe]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=677</guid>
		<description><![CDATA[A couple of months back I was installed some communication software that made a VPN connection to the main server. It used OpenVPN to establish the connection and worked fine as long as your were an administrator on the PC. As I researched it further it installed a service and required that service to run [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of months back I was installed some communication software that made a VPN connection to the main server. It used OpenVPN to establish the connection and worked fine as long as your were an administrator on the PC. As I researched it further it installed a service and required that service to run on demand when the user launch the program. Since your standard limited user does not have privileges to start and stop services the application would fail to connect to the server. </p>
<p>So now the question becomes, how do you add permissions to a service? </p>
<p>Microsoft has an answer with a little known command line application called subinacl. This application allows you to view and edit security information for files, registry keys, and services. This can be handy if you are writing a script to change permissions on registry keys or files but the real power lies within the ability to edit the security information on services.</p>
<p>The syntax for subinacl: <code>SUBINACL /SERVICE \\MachineName\ServiceName /GRANT=[DomainName\]UserName[=Access]</code></p>
<p>The Access parameter is broken down like this:<br />
<code><br />
   F : Full Control<br />
   R : Generic Read<br />
   W : Generic Write<br />
   X : Generic eXecute<br />
   L : Read controL<br />
   Q : Query Service Configuration<br />
   S : Query Service Status<br />
   E : Enumerate Dependent Services<br />
   C : Service Change Configuration<br />
   T : Start Service<br />
   O : Stop Service<br />
   P : Pause/Continue Service<br />
   I : Interrogate Service<br />
   U : Service User-Defined Control Commands<br />
</code><br />
For my example I just needed to allow the Domain Users group access to run the OpenVPN service.</p>
<p><code>subinacl /service OpenVPN /GRANT=DOMAIN\Domain Users=TO</code></p>
<p>You may need to execute this from the folder where <em>subinacl.exe</em> is located. Also if it is running the command on a local system you can just type the name of the service and not the UNC path to the service.</p>
<p>Download <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=E8BA3E56-D8FE-4A91-93CF-ED6985E3927B&#038;displaylang=en">subinacl.exe from Microsoft</a><br />
For more information about this command please visit: <a href="http://support.microsoft.com/kb/288129">http://support.microsoft.com/kb/288129</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2010/02/how-to-set-permission-on-a-service-using-subinacl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Report Workstation Uptime in a CSV using Active Directory and VBS</title>
		<link>http://www.waynezim.com/2009/07/report-workstation-uptime-in-a-csv-using-active-directory-and-vbs/</link>
		<comments>http://www.waynezim.com/2009/07/report-workstation-uptime-in-a-csv-using-active-directory-and-vbs/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 19:56:09 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Uptime]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[VBscript]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=437</guid>
		<description><![CDATA[Have you ever been left wondering which computers on your domain have been neglected by their user and not restarted in forever? This is a question that come up in my office every once and a while. One of the easiest ways to solve this problem is to ask WMI for when the computer was [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever been left wondering which computers on your domain have been neglected by their user and not restarted in forever? This is a question that come up in my office every once and a while. One of the easiest ways to solve this problem is to ask WMI for when the computer was last restarted and subtract it from the current time. Also, while asking WMI questions you might as well ask which user is currently logged on the PC that way you know who to blame. This is exactly what the following script does for your domain. It grabs the list of workstations from the domain then queries WMI for the last time the computer is restarted and does some conversion and math and makes you an nice CSV that you can play with. </p>
<p><b>Script Configuration</b><br />
Before running this script there is some minor configuration that must be done so it can communicate with your Active Directory setup.
<ol>
<li>Find <code>objConnection.Open "Active Directory Server"</code> change <em>Active Directory Server</em> to the name of your Domain Controller</li>
<li>Find <code>objCommand.CommandText = _<br />
    "Select Name, Location from 'LDAP://OU=Workstations,DC=west,DC=domain,DC=edu' " _<br />
        &#038; "Where objectClass='computer'"</code> change <em>subdomain</em>, <em>domain</em>, and <em>suffix</em> to the name of your domain i.e. west domain edu (respectively)</li>
<li>Find <code>GetUptime objRecordSet.Fields("Name").Value, "C:\uptime.csv"</code> and change <em>C:\uptime.csv</em> to the location where you want the file saved. Be sure to save it with the extension CSV
</ol>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.waynezim.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=437&amp;download=GetUptime.vbs">GetUptime.vbs</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4372"><td class="code" id="p437code2"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Const</span> ADS_SCOPE_SUBTREE = 2
&nbsp;
<span style="color: #000080;">Set</span> objConnection = CreateObject(<span style="color: #800000;">&quot;ADODB.Connection&quot;</span>)
<span style="color: #000080;">Set</span> objCommand =   CreateObject(<span style="color: #800000;">&quot;ADODB.Command&quot;</span>)
objConnection.Provider = <span style="color: #800000;">&quot;ADsDSOObject&quot;</span>
objConnection.<span style="color: #000080;">Open</span> <span style="color: #800000;">&quot;Active Directory Server&quot;</span> 
&nbsp;
<span style="color: #000080;">Set</span> objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
    <span style="color: #800000;">&quot;Select Name, Location from 'OU=Workstations,DC=west,DC=domain,DC=edu' &quot;</span> _
        &amp; <span style="color: #800000;">&quot;Where objectClass='computer'&quot;</span>  
objCommand.Properties(<span style="color: #800000;">&quot;Page Size&quot;</span>) = 1000
objCommand.Properties(<span style="color: #800000;">&quot;Searchscope&quot;</span>) = ADS_SCOPE_SUBTREE 
<span style="color: #000080;">Set</span> objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
&nbsp;
<span style="color: #000080;">Do</span> <span style="color: #000080;">Until</span> objRecordSet.EOF
	GetUptime objRecordSet.Fields(<span style="color: #800000;">&quot;Name&quot;</span>).Value, <span style="color: #800000;">&quot;C:\uptime.csv&quot;</span>
    objRecordSet.MoveNext
<span style="color: #000080;">Loop</span>
&nbsp;
<span style="color: #000080;">Sub</span> GetUptime(strComputer, strFilename)
	<span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">Resume</span> <span style="color: #000080;">Next</span>
	<span style="color: #000080;">Set</span> StdOut = WScript.StdOut
&nbsp;
	<span style="color: #000080;">Set</span> objFSO = CreateObject(<span style="color: #800000;">&quot;scripting.filesystemobject&quot;</span>)
	<span style="color: #000080;">Set</span> logStream = objFSO.opentextfile(strFilename, 8, <span style="color: #000080;">True</span>)
&nbsp;
	<span style="color: #000080;">Set</span> oReg=GetObject(<span style="color: #800000;">&quot;winmgmts:{impersonationLevel=impersonate}!\\&quot;</span> &amp; strComputer &amp; <span style="color: #800000;">&quot;\root\default:StdRegProv&quot;</span>)
	<span style="color: #000080;">If</span> Err.Number <span style="color: #000080;">Then</span>
	      logStream.writeline(strComputer &amp; <span style="color: #800000;">&quot;,Offline&quot;</span>)
	      Err.Clear
	<span style="color: #000080;">Else</span>
		<span style="color: #000080;">Set</span> objWMIService = GetObject _
			(<span style="color: #800000;">&quot;winmgmts:\\&quot;</span> &amp; strComputer &amp; <span style="color: #800000;">&quot;\root\cimv2&quot;</span>)
		<span style="color: #000080;">Set</span> colOperatingSystems = objWMIService.ExecQuery _
			(<span style="color: #800000;">&quot;Select * from Win32_OperatingSystem&quot;</span>)
		<span style="color: #000080;">For</span> <span style="color: #000080;">Each</span> objOS <span style="color: #000080;">in</span> colOperatingSystems
			dtmBootup = objOS.LastBootUpTime
			dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
			dtmSystemUptime = DateDiff(<span style="color: #800000;">&quot;h&quot;</span>, dtmLastBootUpTime, Now()) 
		<span style="color: #000080;">Next</span>
		<span style="color: #000080;">Set</span> objWMIService = GetObject _
			(<span style="color: #800000;">&quot;winmgmts:\\&quot;</span> &amp; strComputer &amp; <span style="color: #800000;">&quot;\root\cimv2&quot;</span>)
		<span style="color: #000080;">Set</span> colComputerSys = objWMIService.ExecQuery _
			(<span style="color: #800000;">&quot;Select UserName from Win32_ComputerSystem&quot;</span>)
		<span style="color: #000080;">For</span> <span style="color: #000080;">Each</span> objCS <span style="color: #000080;">in</span> colComputerSys
			username = objCS.UserName
			logStream.writeline(strComputer &amp; <span style="color: #800000;">&quot;,Online,&quot;</span> &amp; dtmSystemUptime &amp; <span style="color: #800000;">&quot;,&quot;</span> &amp; dtmLastBootupTime &amp; <span style="color: #800000;">&quot;,&quot;</span> &amp; username) 
		<span style="color: #000080;">Next</span>
&nbsp;
	<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
	logStream.<span style="color: #000080;">Close</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
<span style="color: #000080;">Function</span> WMIDateStringToDate(dtmBootup)
    WMIDateStringToDate = <span style="color: #000080;">CDate</span>(Mid(dtmBootup, 5, 2) &amp; <span style="color: #800000;">&quot;/&quot;</span> &amp; _
         Mid(dtmBootup, 7, 2) &amp; <span style="color: #800000;">&quot;/&quot;</span> &amp; Left(dtmBootup, 4) _
         &amp; <span style="color: #800000;">&quot; &quot;</span> &amp; Mid (dtmBootup, 9, 2) &amp; <span style="color: #800000;">&quot;:&quot;</span> &amp; _
         Mid(dtmBootup, 11, 2) &amp; <span style="color: #800000;">&quot;:&quot;</span> &amp; Mid(dtmBootup, _
         13, 2))
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/07/report-workstation-uptime-in-a-csv-using-active-directory-and-vbs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Use WMI Filtering to Improve Group Policy Administration</title>
		<link>http://www.waynezim.com/2009/07/how-to-use-wmi-filtering-to-improve-group-policy-administration/</link>
		<comments>http://www.waynezim.com/2009/07/how-to-use-wmi-filtering-to-improve-group-policy-administration/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 20:05:30 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Filtering]]></category>
		<category><![CDATA[GPMC]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=415</guid>
		<description><![CDATA[Group policy is one of the most versatile and powerful ways to manage your workstations in your domain. However, using just basic Group Policy to object relationship links you can limit the customization that is possible with group policy. Today I will show you how to add WMI (Windows Management Interface) Filtering to your group [...]]]></description>
			<content:encoded><![CDATA[<p>Group policy is one of the most versatile and powerful ways to manage your workstations in your domain. However, using just basic Group Policy to object relationship links you can limit the customization that is possible with group policy. Today I will show you how to add WMI (Windows Management Interface) Filtering to your group policy. This will allow you to build a kind of rule, and allow you to pick and choose which workstations get the policy and which don&#8217;t. My goal today is to apply my group policy to only workstations that start with the name of shs-exam. This is basically all the workstations that reside in our exam rooms and I would like them to have a special set of settings, however I want them to co-exist in my Active Directory structure in the proper &#8216;departmental&#8217; organizational units that I already have.<br />
<b> Requirements</b><a href="http://www.waynezim.com/wp-content/uploads/2009/07/wmi-query.png"><img src="http://www.waynezim.com/wp-content/uploads/2009/07/wmi-query-300x218.png" alt="wmi-query" title="wmi-query" width="300" height="218" class="alignright size-medium wp-image-419" /></a></p>
<ul>
<li><a href="http://www.microsoft.com/windowsserver2003/gpmc/default.mspx">Group Policy Management Console (gpmc.msc)</a></li>
<li>Preexisting Group Policy needing WMI filtering</li>
<li>Understanding about WMI Information</li>
</ul>
<p><b>Configuration</b></p>
<ol>
<li>Open your Group Policy Management Console and browse to WMI Filters in your Domain.</li>
<li>Go ahead and Right Click on WMI Filters and select New</li>
<li>Give the WMI Filter a nice descriptive name and give more detailed text in the Description if needed.</li>
<li>To build your actual query for WMI you need to think of this as a question to ask the PC and if it returns any result then the Group Policy will be applied to it. The query I have built asks it to return name for the computer and if the name contains &#8220;SHS-EXAM&#8221; then it will return the name and get the group policy applied, if not then nothing happens and the group policy is skipped.</li>
<p><a href="http://www.waynezim.com/wp-content/uploads/2009/07/group-policy-scope-wmi-filtering.png"><img src="http://www.waynezim.com/wp-content/uploads/2009/07/group-policy-scope-wmi-filtering-293x300.png" alt="group-policy-scope-wmi-filtering" title="group-policy-scope-wmi-filtering" width="293" height="300" class="alignright size-medium wp-image-418" /></a></p>
<li>Add your WMI Query, mine is <em>Select name from Win32_ComputerSystem WHERE NOT name LIKE &#8220;%SHS-EXAM%&#8221;</em> This will basically select all computers that are not named &#8220;SHS-EXAM&#8221;</li>
<li>Now press Save</li>
<li>Now that we have successfully made the WMI Filter we need to apply it to the proper group policy, so go to your Group Policy Objects under your domain and select the one you wish to add the filter to. </li>
<li>The last section on the screen should be WMI Filtering, just drop down the list and select the WMI Filter you just made</li>
</ol>
<p><b>Reference Material</b></p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/aa394606%28VS.85%29.aspx">WQL (SQL for WMI) (Windows)</a> &#8211; This is a great list of advanced operators and examples to get you close the the proper syntax</li>
<li><a href="http://support.microsoft.com/kb/555253">HOWTO: Leverage Group Policies with WMI Filters</a> &#8211; This article explains in detail how to create a WMI filter to determine the scope of a Group Policy based on computer attributes.</li>
<li><a href="http://www.paessler.com/tools/wmitester">Paessler WMI Tester</a> &#8211; This tool can help you test your WMI queries before deploying them in Group Policy use. I use this tool all the time to help find information about a workstation.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/aa394084%28VS.85%29.aspx">Microsoft Win32 Classes Reference</a> &#8211; This is a Microsoft&#8217;s reference for all of the objects and events for WMI. You can use this to find that specific settings you need to filter on.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/07/how-to-use-wmi-filtering-to-improve-group-policy-administration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Setup a Legal Notice Before Login in Group Policy</title>
		<link>http://www.waynezim.com/2009/06/how-to-setup-a-legal-notice-before-login-in-group-policy/</link>
		<comments>http://www.waynezim.com/2009/06/how-to-setup-a-legal-notice-before-login-in-group-policy/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 20:20:14 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[GPMC]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[Legal Notice]]></category>
		<category><![CDATA[Logon]]></category>
		<category><![CDATA[Logon Message]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=300</guid>
		<description><![CDATA[A few days ago I was tasked with setting up a notice to users before the actually log on to the computer to notify them that if they use this computer they agree to blah.. blah.. blah legal stuff. To solve this, I decided that this would be good to see on every computer we [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I was tasked with setting up a notice to users before the actually log on to the computer to notify them that if they use this computer they agree to blah.. blah.. blah legal stuff. To solve this, I decided that this would be good to see on every computer we have in the organization so I added it to the Default Domain Policy, but this can be applied to users or computers at any level you see fit. This is a very easy setting that may also substitute for signing the computer usage agreements every year.
<ol><a href="http://www.waynezim.com/wp-content/uploads/2009/06/legal-notice-group-policy-settings.png"><img src="http://www.waynezim.com/wp-content/uploads/2009/06/legal-notice-group-policy-settings-300x211.png" alt="legal-notice-group-policy-settings" title="legal-notice-group-policy-settings" width="300" height="211" class="alignright size-medium wp-image-303" /></a></p>
<li>Open up your Group Policy Management Console (gpmc.msc)</li>
<li>Go to the <em>Group Policy Object</em> in your domain, right click on <em>Default Domain Policy</em> and select <em>Edit&#8230;</em></li>
<li>Once the Group Policy Editor is up, using the treeview on on the left go to <em>Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options</em></li>
<li>To edit the title of the windows change: <em>Interactive logon:Message title for users attempting to log on</em></li>
<li>To edit the message text change: <em>Interactive Logon:Message text for users attempting to log on</em></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/06/how-to-setup-a-legal-notice-before-login-in-group-policy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Deploy Microsoft Office 2007 using Group Policy</title>
		<link>http://www.waynezim.com/2009/06/how-to-deploy-microsoft-office-2007-using-group-policy/</link>
		<comments>http://www.waynezim.com/2009/06/how-to-deploy-microsoft-office-2007-using-group-policy/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 19:00:18 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[config.xml]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[GPMC]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[Install]]></category>
		<category><![CDATA[Logon]]></category>
		<category><![CDATA[MSI]]></category>
		<category><![CDATA[MST]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=252</guid>
		<description><![CDATA[Every few years you get the opportunity to update to that new fresh version of Microsoft Office, but you defiantly do not want to go computer to computer uninstalling the old and installing the new version. In the past you have just been able to create an MST and deploy it in group policy, this [...]]]></description>
			<content:encoded><![CDATA[<p>Every few years you get the opportunity to update to that new fresh version of Microsoft Office, but you defiantly do not want to go computer to computer uninstalling the old and installing the new version. In the past you have just been able to create an MST and deploy it in group policy, this is not the case anymore. Microsoft is trying to push the System Management Server for most the large corporate environments, however I work at a place where spending money is not so much a popular topic, it is better to solve the problem withe the stuff you already have. Since you can&#8217;t make a MST to push out Microsoft Office 2007 customized you get a fancy XML file to play with to customized your installation so you can include things like Product Key, Organization, Display Levels of Installer, Accept the EULA, and which parts of Microsoft Office to install. This XML file is very unfriendly because it is very hard to determine the proper syntax or options since the Microsoft documentation is well&#8230; lacking to say the least. Other important things to note, this can only be deployed to as part of a Group Policy for a Computer. It will remind you of this if you try to add the MSI to the Users Group Policy. Microsoft also recommends that you don&#8217;t deploy this in large networks because of effects on the bandwidth required to install over the network cannot be managed like they can with System Management Server.<br />
<br /><b>Network Share Setup</b></p>
<ol>
<li>Copy your entire Microsoft Office 2007 disk out to a network share that is readable by any user in your domain.</li>
<li>Browse to the Enterprise.WW folder or Pro.WW folder in your deployment network share.</li>
<li>Now Find or Create the config.xml file, scroll down and you can see a sample of mine at the bottom of this post. This is the key file that you will be modifying to customize your deployment of Microsoft Office 2007</li>
</ol>
<p><b>Customizing the Microsoft Office 2007 deployment using config.xml</b><br />
This is where all the magic happens if that is what you want to call it. There is several lines in this file I will try to hit the most important ones that you will need to use. At the bottom of the post you will be able to find the copy my config.xml file that I used for my deployment.
<ul>
<li><code>&lt;Display Level="full" CompletionNotice="yes" SuppressModal="no" AcceptEula="yes" /&gt;</code> &#8211; These options have to do with how setup is displayed to the user.<br /><em>Display Level</em> can be set to <em>None</em>, <em>Basic</em> or <em>Full</em> by default it is <em>Full</em>. <em>Full</em>: shows the entire setup to the user and allow them to modify options along the way. <em>Basic</em>: shows a welcome screen, Product Key if not included in config.xml file, EULA if not accepted, progress bar and Completion if allowed.<br /><em>CompletionNotice</em> can bet set to <em>Yes</em> or <em>No</em> and is <em>No</em> by default and it will give a final screen showing that it had finished or not.<br /><em>SuppressModal</em> can be <em>Yes</em> or <em>No</em> and is <em>No</em> by default and will suppress errors if set to <em>Yes</em>.<br />AcceptEula can be set to <em>Yes</em> or <em>No</em> and is <em>No</em> by default, this makes the user accept the license agreement have to accept the EULA if set to <em>No</em>. I would strongly suggest setting this to <em>Yes</em> to save your users the trouble.</li>
<li><code>&lt;PIDKEY Value="xxxxxxxxxxxxxxxxxxxxxxxxx" /&gt;</code> &#8211; This is where you insert your product key.<br />If you <em>DisplayLevel</em> is set to <em>Basic</em> or <em>None</em> and you enter a product key it will automatically accept the EULA for the installation reguardless of what <em>AcceptEula</em> is set to.</li>
<li><code>&lt;COMPANYNAME Value="My Cool Company" /&gt;</code> &#8211; Allows you to modify the organization field for the software registration</li>
<li><code>&lt;OptionState Id="ACCESSFiles" State="Local" Children="force" /&gt;</code> &#8211; These lines help determine which parts of Microsoft Office 2007 will be installed. The <em>ID</em> element varies depending on what version of Office you are installing. The <em>State</em> option allows you to determine if you want to install this portion of Office or not. It can be set to <em>Absent</em>, which will not install it, <em>Advertise</em>, which will install on first use, <em>Local</em>, which will install it item, or <em>default</em> which will do the Microsoft default action for the element. The option <em>Children</em> is specific to the <em>ID</em> and if set to <em>force</em> will install all sub items, I prefer this that way you don&#8217;t ever have to worry about dependence or special features some user might want to use.</li>
<li><code>&lt;Setting Id="RemovePrevious" Value="ACCESSFiles,EXCELFiles,OUTLOOKFiles,PPTFiles,PubPrimary,WORDFiles" /></code> &#8211; This is an important line if you are wanting it to replace or uninstall the current version of Microsoft Office that is installed like Office 2003 or XP during the installation of Microsoft Office 2007.</li>
</ul>
<p><b>Adding the MSI to Group Policy</b><br />
This next step is very simple as you need to go to the Group Policy that will be in charge of installing Office 2007. Now open up your Group Policy Managment Console and select the GP you plan to use to deploy office, then right click and select edit. Now use the Tree on the Left to browse to <em>Computer Configuration > Software Settings > Software Installation</em> and right click on <em>Software Installation</em> and select<em> New > Package…</em> It will now prompt you with an open dialog box, go and select the MSI in the Office deployment directory for Enterprise it is called <em>EnterpriseWW.msi</em>. That&#8217;s it! Now just be sure to apply that Group Policy to the correct workstations and you will be good to go. The workstations should get the new version of Office 2007 next time it is restarted. You may want to test deploy it to a few machines to make sure everything goes smoothly.<br />
<br /><b>Resources</b></p>
<ul>
<li><a href="http://technet.microsoft.com/en-us/library/cc179195.aspx">Config.xml file in the 2007 Office system</a></li>
<li><a href="http://technet.microsoft.com/en-us/library/cc179214.aspx">Use Group Policy Software Installation to deploy the 2007 Office system</a></li>
<li><a href="http://technet.microsoft.com/en-us/library/cc179063.aspx">Create a Network Installation Point for the 2007 Office system</a></li>
</ul>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.waynezim.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=252&amp;download=config.xml">config.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2524"><td class="code" id="p252code4"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Configuration</span> <span style="color: #000066;">Product</span>=<span style="color: #ff0000;">&quot;Enterprise&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Display</span> <span style="color: #000066;">Level</span>=<span style="color: #ff0000;">&quot;full&quot;</span> <span style="color: #000066;">CompletionNotice</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000066;">SuppressModal</span>=<span style="color: #ff0000;">&quot;no&quot;</span> <span style="color: #000066;">AcceptEula</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- &lt;Logging Type=&quot;standard&quot; Path=&quot;%temp%&quot; Template=&quot;Microsoft Office Enterprise Setup(*).txt&quot; /&gt; --&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PIDKEY</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;xxxxxxxxxxxxxxxxxxxxxxxxx&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- &lt;USERNAME Value=&quot;Customer&quot; /&gt; --&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;COMPANYNAME</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;My Organization&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- &lt;INSTALLLOCATION Value=&quot;%programfiles%\Microsoft Office&quot; /&gt; --&gt;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- &lt;LIS CACHEACTION=&quot;CacheOnly&quot; /&gt; --&gt;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- &lt;SOURCELIST Value=&quot;\\server\Apps\Office2007&quot; /&gt; --&gt;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- &lt;DistributionPoint Location=&quot;\\server\Apps\Office2007&quot; /&gt; --&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;ACCESSFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;EXCELFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;GrooveFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Absent&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;OneNoteFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;OUTLOOKFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;PPTFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;PubPrimary&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;WORDFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;XDOCSFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;SHAREDFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OptionState</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;TOOLSFiles&quot;</span> <span style="color: #000066;">State</span>=<span style="color: #ff0000;">&quot;Local&quot;</span> <span style="color: #000066;">Children</span>=<span style="color: #ff0000;">&quot;force&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setting</span> <span style="color: #000066;">Id</span>=<span style="color: #ff0000;">&quot;RemovePrevious&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;ACCESSFiles,EXCELFiles,OUTLOOKFiles,PPTFiles,PubPrimary,WORDFiles&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
&nbsp;
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- &lt;Setting Id=&quot;Reboot&quot; Value=&quot;IfNeeded&quot; /&gt; --&gt;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- &lt;Command Path=&quot;msiexec.exe&quot; Args=&quot;/i \\server\share\my.msi&quot; QuietArg=&quot;/q&quot; ChainPosition=&quot;after&quot; Execute=&quot;install&quot; /&gt; --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/06/how-to-deploy-microsoft-office-2007-using-group-policy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>List All Active Directory User Accounts in a CSV</title>
		<link>http://www.waynezim.com/2009/05/list-all-active-directory-user-accounts-in-a-csv/</link>
		<comments>http://www.waynezim.com/2009/05/list-all-active-directory-user-accounts-in-a-csv/#comments</comments>
		<pubDate>Wed, 20 May 2009 20:51:03 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[User Accounts]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[VBscript]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=185</guid>
		<description><![CDATA[We all know maintaining hundreds of user accounts can be frustrating especially when it comes to audit time and you need a good list of information to pass on to an auditor. Well today I am your savory, this simple script will produce you a list of users with some detailed information that can make [...]]]></description>
			<content:encoded><![CDATA[<p>We all know maintaining hundreds of user accounts can be frustrating especially when it comes to audit time and you need a good list of information to pass on to an auditor. Well today I am your savory, this simple script will produce you a list of users with some detailed information that can make audits or documentation much easier. The script creates a Comma Separated Values file or CSV that you can edit in Microsoft Excel or any standard spreadsheet application so you can customize the information before adding it to your report or audit. Below are the specific fields that this script will provide detail on for your Active Directory Users.
<p><b>User Details</b>
<ul>
<li>Name</li>
<li>Description</li>
<li>Profile Path</li>
<li>Home Drive</li>
<li>Account Disabled</li>
<li>Password Required</li>
<li>User Changable Password</li>
<li>Password Expires</li>
<li>SmartCard Required</li>
<li>Login Count</li>
<li>Last Login (date)</li>
<li>Last Password Change (date)</li>
<li>Created (date)</li>
<li>Modified (date)</li>
</ul>
<p><b>Script Configuration</b><br />
Before running this script there is some minor configuration that must be done so it can communicate with your Active Directory setup.
<ol>
<li>Find <code>objConnection.Open "Active Directory Server"</code> change <em>Active Directory Server</em> to the name of your Domain Controller</li>
<li>Find <code>objCommand.CommandText = _<br />
    "SELECT Name, description, profilePath, homeDrive, distinguishedName,userAccountControl FROM 'LDAP://dc=subdomain,dc=domain,dc=suffix' WHERE objectCategory='user'"</code> change <em>subdomain</em>, <em>domain</em>, and <em>suffix</em> to the name of your domain i.e. west consco com (respectively)</li>
<li>Find <code>Set logStream = objFSO.opentextfile("C:\domainusers.csv", 8, True)</code> and change <em>C:\domainusers.csv</em> to the location where you want the file saved. Be sure to save it with the extension CSV
</ol>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.waynezim.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=185&amp;download=ListUserAccounts.vbs">ListUserAccounts.vbs</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1856"><td class="code" id="p185code6"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">Resume</span> <span style="color: #000080;">Next</span>
<span style="color: #000080;">Const</span> ADS_SCOPE_SUBTREE = 2
&nbsp;
<span style="color: #000080;">Const</span> ADS_UF_ACCOUNTDISABLE = &amp;H0002 
<span style="color: #000080;">Const</span> ADS_UF_PASSWD_NOTREQD = &amp;H0020 
<span style="color: #000080;">Const</span> ADS_UF_PASSWD_CANT_CHANGE = &amp;H0040 
<span style="color: #000080;">Const</span> ADS_UF_DONT_EXPIRE_PASSWD = &amp;H10000 
<span style="color: #000080;">Const</span> ADS_UF_SMARTCARD_REQUIRED = &amp;H40000 
&nbsp;
<span style="color: #000080;">Set</span> objConnection = CreateObject(<span style="color: #800000;">&quot;ADODB.Connection&quot;</span>)
<span style="color: #000080;">Set</span> objCommand =   CreateObject(<span style="color: #800000;">&quot;ADODB.Command&quot;</span>)
objConnection.Provider = <span style="color: #800000;">&quot;ADsDSOObject&quot;</span>
objConnection.<span style="color: #000080;">Open</span> <span style="color: #800000;">&quot;Active Directory Server&quot;</span>
<span style="color: #000080;">Set</span> objCommand.ActiveConnection = objConnection
&nbsp;
objCommand.Properties(<span style="color: #800000;">&quot;Page Size&quot;</span>) = 1000
objCommand.Properties(<span style="color: #800000;">&quot;Searchscope&quot;</span>) = ADS_SCOPE_SUBTREE 
&nbsp;
objCommand.CommandText = _
    <span style="color: #800000;">&quot;SELECT Name, description, profilePath, homeDrive, distinguishedName,userAccountControl FROM 'LDAP://dc=subdomain,dc=domain,dc=suffix' WHERE objectCategory='user'&quot;</span>  
<span style="color: #000080;">Set</span> objRecordSet = objCommand.Execute
&nbsp;
objRecordSet.MoveFirst
<span style="color: #000080;">Set</span> objFSO = CreateObject(<span style="color: #800000;">&quot;scripting.filesystemobject&quot;</span>)
<span style="color: #000080;">Set</span> logStream = objFSO.opentextfile(<span style="color: #800000;">&quot;C:\domainusers.csv&quot;</span>, 8, <span style="color: #000080;">True</span>)
logStream.writeline(<span style="color: #800000;">&quot;Name,Description,Profile Path,Home Drive,Account Disabled,Password Required,User Changable Password,Password Expires,SmartCard Required,Login Count,Last Login,Last Password Change,Created,Modified&quot;</span>)
<span style="color: #000080;">Do</span> <span style="color: #000080;">Until</span> objRecordSet.EOF
&nbsp;
	strDN = objRecordset.Fields(<span style="color: #800000;">&quot;distinguishedName&quot;</span>).Value 
	<span style="color: #000080;">Set</span> objUser = GetObject (<span style="color: #800000;">&quot;LDAP://&quot;</span> &amp; strDN)
&nbsp;
	<span style="color: #000080;">If</span> objRecordset.Fields(<span style="color: #800000;">&quot;userAccountControl&quot;</span>).Value <span style="color: #000080;">AND</span> ADS_UF_ACCOUNTDISABLE <span style="color: #000080;">Then</span>
		Text = <span style="color: #800000;">&quot;Yes&quot;</span>
	<span style="color: #000080;">Else</span>
		Text = <span style="color: #800000;">&quot;No&quot;</span>
	<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
	<span style="color: #000080;">If</span> objRecordset.Fields(<span style="color: #800000;">&quot;userAccountControl&quot;</span>).Value <span style="color: #000080;">AND</span> ADS_UF_PASSWD_NOTREQD <span style="color: #000080;">Then</span>
		Text = Text &amp; <span style="color: #800000;">&quot;,No&quot;</span>
	<span style="color: #000080;">Else</span>
		Text = Text &amp; <span style="color: #800000;">&quot;,Yes&quot;</span>
	<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
	<span style="color: #000080;">If</span> objRecordset.Fields(<span style="color: #800000;">&quot;userAccountControl&quot;</span>).Value <span style="color: #000080;">AND</span> ADS_PASSWORD_CANT_CHANGE <span style="color: #000080;">Then</span>
		Text = Text &amp; <span style="color: #800000;">&quot;,No&quot;</span>
	<span style="color: #000080;">Else</span>
		Text = Text &amp; <span style="color: #800000;">&quot;,Yes&quot;</span>
	<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>	 
	<span style="color: #000080;">If</span> objRecordset.Fields(<span style="color: #800000;">&quot;userAccountControl&quot;</span>).Value <span style="color: #000080;">AND</span> ADS_UF_DONT_EXPIRE_PASSWD <span style="color: #000080;">Then</span>
		Text = Text &amp; <span style="color: #800000;">&quot;,No&quot;</span>
	<span style="color: #000080;">Else</span>
		Text = Text &amp; <span style="color: #800000;">&quot;,Yes&quot;</span>
	<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
	<span style="color: #000080;">If</span> objRecordset.Fields(<span style="color: #800000;">&quot;userAccountControl&quot;</span>).Value <span style="color: #000080;">AND</span> ADS_UF_SMARTCARD_REQUIRED <span style="color: #000080;">Then</span>
		Text = Text &amp; <span style="color: #800000;">&quot;,Yes&quot;</span>
	<span style="color: #000080;">Else</span>
		Text = Text &amp; <span style="color: #800000;">&quot;,No&quot;</span>
	<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
	logStream.writeline(objRecordset.Fields(<span style="color: #800000;">&quot;Name&quot;</span>).Value &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; objRecordset.Fields(<span style="color: #800000;">&quot;description&quot;</span>).Value &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; objRecordset.Fields(<span style="color: #800000;">&quot;profilePath&quot;</span>).Value &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; objRecordset.Fields(<span style="color: #800000;">&quot;homeDrive&quot;</span>).Value &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; text &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; objUser.logonCount &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; objUser.LastLogin &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; objUser.PasswordLastChanged &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; objUser.whenCreated &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		&amp; objUser.whenChanged &amp; <span style="color: #800000;">&quot;,&quot;</span>_
		)
&nbsp;
    objRecordSet.MoveNext
<span style="color: #000080;">Loop</span>
logStream.<span style="color: #000080;">Close</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/05/list-all-active-directory-user-accounts-in-a-csv/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to Deploy VNC using Group Policy</title>
		<link>http://www.waynezim.com/2009/05/how-to-deploy-vnc-using-group-policy/</link>
		<comments>http://www.waynezim.com/2009/05/how-to-deploy-vnc-using-group-policy/#comments</comments>
		<pubDate>Wed, 13 May 2009 21:36:32 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[GPMC]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[Group Policy Managment Console]]></category>
		<category><![CDATA[MSI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[UltraVNC]]></category>
		<category><![CDATA[User Accounts]]></category>
		<category><![CDATA[VNC]]></category>
		<category><![CDATA[VNCed]]></category>
		<category><![CDATA[Windows Firewall]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=79</guid>
		<description><![CDATA[Do you spend too much time running from desk to desk just to help someone make a shortcut or change the default printer? This could be the solution for you. Using UltraVNC you can remotely view and control their workstation from your desk. This can save you time from running around everywhere, and make your [...]]]></description>
			<content:encoded><![CDATA[<p>Do you spend too much time running from desk to desk just to help someone make a shortcut or change the default printer? This could be the solution for you. Using UltraVNC you can remotely view and control their workstation from your desk. This can save you time from running around everywhere, and make your users happier faster by solving their problems on the spot. You can also make your boss happy be making it authenticate with Active Directory. That will ensure that everyone that has the remote support access uses their own username and password, and it is easily managed with Active Directory Groups. VNC works very simply by installing a server on every workstation which allows it to share out the desktop to other clients / viewer programs. By installing the VNC Server on all your workstations it will allow you to connect using the client / viewer application and provide hands on support directly from your workstation. </p>
<p><strong>Requirements</strong>
<ul>
<li>Microsoft Domain</li>
<li><a href="http://www.uvnc.com/download/">UltraVNC 1.0.2</a></li>
<li><a href="http://vnced.sourceforge.net/downloads.php">VNCed UltraVNC MSI Creator 1.1.3</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0A6D4C24-8CBD-4B35-9272-DD3CBFC81887&#038;displaylang=en">Group Policy Management Console</a></li>
</ul>
<p><strong>Making the MSI using VNCed</strong><br />
Now that you have the required software, the first thing we need to do is uncompress the VNCed UltraVNC MSI Creator to a folder on your desktop. Once completed, run the <b>run.bat</b> and it should popup a GUI interface you can use to configure different parts of the UltraVNC Server.<img src="http://www.waynezim.com/wp-content/uploads/2009/05/vnced-msi-creator-180x300.png" alt="VNCed UltraVNC MSI Maker" title="VNCed UltraVNC MSI Maker" width="180" height="300" class="alignright size-medium wp-image-83" /><br />Using this interface you can adjust and explore what options you have to choose from to customize your UltraVNC Deployment for your environment. The defaults here are a pretty good start and you can click on each item to get a description of what it will change. You may want to install this to a test computer a few times before rolling it out.<br />At this time you also need to configure if you will be using if you will be using Active Directory Authentication or just a plain password.
<p>
 &#8211; To setup the plain password just fill out the <em>password</em> item and leave the <em>newMSLogon</em> unchecked.<br /> &#8211; To setup Active Directory Authentication check the  <em>newMSLogon</em> and you will need to make a file to select for <em>aclImportFile</em>. This file can either be generated based on the <a href="http://www.uvnc.com/features/authentication.html#mslogonacl">UltraVNC Instructions</a> or you can use my file by creating a text file called: MSACL.ini and pasting <code>allow	0x00000003	"..\Domain Admins</code> in to it. That will allow anyone in the Domain Admins group to have full access to any machine setup using this MSI.
<p>Once you have finished configuring the options for UltraVNC hit the <em>Generate UltraVNC MSI</em> button at the bottom. This will generate your UltraVNC.msi in the folder in which VNCed was extracted to. This file is what you will use to deploy UltraVNC to your workstations. </p>
<p><strong>Using Group Policy to Deploy the MSI</strong><br />
First you will need to open either your <em>Group Policy Management Console (gpmc.msc)</em> and either modify your existing Workstation Group Policy or make a new one just for the deployment of this application depending on how you want to deploy it. By making a different GP to install, it can allow you deploy it just to a few machines, and only change the settings on those machines, where as the workstation method installs it to all workstations. This really up to the requirements of your environment. Either way you will need to look under <em>Group Policy Object</em> for your domain and create one or right click on one and edit it.<img src="http://www.waynezim.com/wp-content/uploads/2009/05/group-policy-software-installtion-300x100.png" alt="Group Policy Software Installation" title="Group Policy Software Installation" width="300" height="100" class="alignleft size-medium wp-image-93" /><br />Now use the Tree on the Left to browse to <em>Computer Configuration > Software Settings > Software Installation</em> and right click on <em>Software Installation</em> and select <em>New > Package&#8230;</em> It will now prompt you with an open dialog box, go and select the MSI that we created earlier. If all goes well you should end up with something like the screenshot shows to the left. If all goes well now the only thing you have to do is link it to the OUs that you want it to effect if you created a new one , or you let your workstation group policy deploy to all the workstations the next time they restart.
<p><strong>Firewall Configuration</strong><a href="http://www.waynezim.com/wp-content/uploads/2009/05/group-policy-firewall-config-ultravnc.png"><img src="http://www.waynezim.com/wp-content/uploads/2009/05/group-policy-firewall-config-ultravnc-300x226.png" alt="Group Policy Firewall Configuration for UltraVNC" title="Group Policy Firewall Configuration for UltraVNC" width="300" height="226" class="alignright size-medium wp-image-98" /></a><br />If you run a firewall on your machine you will need to allow port 5900 open. If you only running the default Windows Firewall you can configure this using the same group policy that you deployed UltraVNC with. Just go to <em>Computer Configuration > Administrative Templates > Network > Network Connections > Windows Firewall > Domain Profile</em> then select <em>Windows Firewall: Define port exceptions</em> select <em>Enabled</em> then click the <em>Show&#8230;</em> button and click <em>Add</em> and fill out the items to specification.
<p>For any other questions you have feel free to leave a comment I will be happy to assist you with the deployment.
<p>For any other detailed information about UltraVNC you should check out their website at <a href="http://www.uvnc.com">http://www.uvnc.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/05/how-to-deploy-vnc-using-group-policy/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Disable Windows Games Using Software Restriction Policy</title>
		<link>http://www.waynezim.com/2009/05/disable-windows-games-using-software-restriction-policy/</link>
		<comments>http://www.waynezim.com/2009/05/disable-windows-games-using-software-restriction-policy/#comments</comments>
		<pubDate>Wed, 06 May 2009 13:15:27 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[Software Restriction Policy]]></category>
		<category><![CDATA[Startup]]></category>
		<category><![CDATA[Windows Games]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=107</guid>
		<description><![CDATA[Do you find that your users spend more time in freecell and minesweeper than actually doing work? Then one would say that it is time to block those applications from being started. To do this you can use the Software Restriction Policy that is Built in to Group Policy and your Domain. What you will [...]]]></description>
			<content:encoded><![CDATA[<p>Do you find that your users spend more time in freecell and minesweeper than actually doing work? Then one would say that it is time to block those applications from being started. To do this you can use the Software Restriction Policy that is Built in to Group Policy and your Domain. What you will need to do is create a new Group Policy, you could call it &#8220;No Windows Games&#8221; and then Edit it and drill down into <em>Computer Configuration > Windows Settings > Security Settings > Software Restriction Policies</em> from there you will probably be presented with &#8220;No Software Restriction Policies Defined&#8221; now right click back on Software Restriction Polices in the tree view on the left and select <em>Create New Policies</em>. Now you should have the option for <em>Additional Rules</em>. This is where you need your restrictions. <a href="http://technet.microsoft.com/en-us/library/bb457006.aspx">Here</a> is the long article about what the different types of rules are, and what you can do with the from Microsoft, but since we just want to block Windows Games we just need to add a <strong>New Path Rules</strong> with the <b>Disallowed</b> option.
<ul>
<li>%SystemRoot%\system32\freecell.exe</li>
<li>%SystemRoot%\system32\mshearts.exe</li>
<li>%SystemRoot%\system32\sol.exe</li>
<li>%SystemRoot%\system32\spider.exe</li>
<li>%SystemRoot%\system32\winmine.exe</li>
<li>C:\Program Files\MSN Gaming Zone</li>
<li>C:\Program Files\Windows NT\Pinball\PINBALL.EXE</li>
</ul>
<p>Once these restriction are in place you can link them to the OU or workstations to make them take effect. Your end result should look something like this:<br />
<a href="http://www.waynezim.com/wp-content/uploads/2009/05/no-windows-games-group-policy.png"><img src="http://www.waynezim.com/wp-content/uploads/2009/05/no-windows-games-group-policy-299x110.png" alt="No Windows Games Group Policy" title="No Windows Games Group Policy" width="299" height="110" class="aligncenter size-medium wp-image-108" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/05/disable-windows-games-using-software-restriction-policy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Remove Temporary Files at Logoff</title>
		<link>http://www.waynezim.com/2009/04/remove-temporary-files-at-logoff/</link>
		<comments>http://www.waynezim.com/2009/04/remove-temporary-files-at-logoff/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 19:17:02 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[Logoff]]></category>
		<category><![CDATA[Temp]]></category>
		<category><![CDATA[Temp Files]]></category>
		<category><![CDATA[Temporary Files]]></category>
		<category><![CDATA[Temporary Internet Files]]></category>
		<category><![CDATA[User Accounts]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[VBscript]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=55</guid>
		<description><![CDATA[Over time users tend to open a lot of items programs that write little files to be used just once to print a document or a small setting for a program. These items build up over time and cause your computer to run slower due to your antivirus solution scanning it, your hard drive taking [...]]]></description>
			<content:encoded><![CDATA[<p>Over time users tend to open a lot of items programs that write little files to be used just once to print a document or a small setting for a program. These items build up over time and cause your computer to run slower due to your antivirus solution scanning it, your hard drive taking longer to find a free space of disk to write your new file or has to spend more time gathering up fragments of your file from in between these temp files. The solution here is pretty simple, these files need to go, and probably the easiest solution is the remove them when the user logs off. This doesn&#8217;t require anymore time for the user and typically isn&#8217;t a problem since most computers are logged on and off once a day.
<p>This script will remove the most common temporary folder for the user as well as remove any of the temporary internet files that they have gathered while surfing the web. When we implemented this script we noticed that the antivirus scan time and how many files it scanned were significantly reduced providing a better and faster workstation for your users. This script should be placed in the Group Policy for users as one of their logoff script.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.waynezim.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=55&amp;download=cleantemp.vbs">cleantemp.vbs</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p558"><td class="code" id="p55code8"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Const</span> TEMPORARY_INTERNET_FILES = &amp;H20&amp;
<span style="color: #000080;">dim</span> intDepth
&nbsp;
<span style="color: #000080;">Set</span> objShell = CreateObject(<span style="color: #800000;">&quot;Shell.Application&quot;</span>)
<span style="color: #000080;">Set</span> objFSO = CreateObject(<span style="color: #800000;">&quot;Scripting.FileSystemObject&quot;</span>)
&nbsp;
<span style="color: #008000;">'Clean User Temporary Intenet Files
</span><span style="color: #000080;">Set</span> objNameSpace = objShell.Namespace(TEMPORARY_INTERNET_FILES)
<span style="color: #000080;">Set</span> objFolderItem = objNameSpace.Self
<span style="color: #000080;">set</span> objFolder=objFSO.GetFolder(objFolderItem.Path)
intDepth=0
RemoveFolder objFolder
&nbsp;
<span style="color: #008000;">'Clean User Temp Files
</span><span style="color: #000080;">Const</span> TemporaryFolder = 2
<span style="color: #000080;">Set</span> tempFolder = objFSO.GetSpecialFolder(TemporaryFolder)
RemoveFolder tempFolder
&nbsp;
&nbsp;
<span style="color: #000080;">sub</span> RemoveFolder(objFolder)
	<span style="color: #008000;">' Recursively remove files and folders
</span>	intDepth=intDepth+1
	<span style="color: #000080;">on</span> <span style="color: #000080;">error</span> <span style="color: #000080;">resume</span> <span style="color: #000080;">next</span>
	<span style="color: #000080;">for</span> <span style="color: #000080;">each</span> objFile <span style="color: #000080;">in</span> objFolder.Files
		objFile.Delete <span style="color: #000080;">true</span>
	<span style="color: #000080;">next</span>
	Err.Clear
	<span style="color: #000080;">on</span> <span style="color: #000080;">error</span> <span style="color: #000080;">goto</span> 0
	<span style="color: #000080;">for</span> <span style="color: #000080;">each</span> objSubfolder <span style="color: #000080;">in</span> objFolder.SubFolders
		RemoveFolder objSubFolder
	<span style="color: #000080;">next</span>
	intDepth=intDepth-1
	<span style="color: #000080;">if</span> intDepth&lt;&gt;0 <span style="color: #000080;">then</span><span style="color: #008000;">' Don't delete top-level folder
</span>		<span style="color: #000080;">on</span> <span style="color: #000080;">error</span> <span style="color: #000080;">resume</span> <span style="color: #000080;">next</span>
		objFolder.Delete <span style="color: #000080;">true</span> 
		err.Clear
		<span style="color: #000080;">on</span> <span style="color: #000080;">error</span> <span style="color: #000080;">goto</span> 0
	<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">sub</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/04/remove-temporary-files-at-logoff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote Shutdown / Logoff Script using WMI</title>
		<link>http://www.waynezim.com/2009/04/remote-shutdown-logoff-script-using-wmi/</link>
		<comments>http://www.waynezim.com/2009/04/remote-shutdown-logoff-script-using-wmi/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 13:21:23 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Force]]></category>
		<category><![CDATA[Logoff]]></category>
		<category><![CDATA[Restart]]></category>
		<category><![CDATA[Shutdown]]></category>
		<category><![CDATA[User Accounts]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[VBscript]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=49</guid>
		<description><![CDATA[Have you ever been sitting at your desk working very hard trying to getting some business analytics report finished for your administrative team, only to be interrupted by the everyday user unable to log on the machine because someone else locked it. Then you have to get up and walk down there and manually login [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever been sitting at your desk working very hard trying to getting some business analytics report finished for your administrative team, only to be interrupted by the everyday user unable to log on the machine because someone else locked it. Then you have to get up and walk down there and manually login and unlock the workstation. Well this is now a thing of the past for you if you have enabled WMI and have a domain or common credentials on your network. This script will simply allow you to unlock a workstation with out getting up from your desk. Unfortunately, I didn&#8217;t write this script but I use it about every other day to unlock a workstation. It has a few good options to allow you to either Logoff / Reboot / Shutdown the workstation. This can also be helpful when the user has locked up the PC and can&#8217;t get it to restart, you can send a command from the workstation you are at for that one to restart. In way you end up using this script it will only save you time, I found it to be very reliable and super fast for resolving the locked computer situation. Also, please browse though the code as it is well commented and you can get a greater understanding of how it exactly works.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.waynezim.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=49&amp;download=remoteshutdown.vbs">remoteshutdown.vbs</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4910"><td class="code" id="p49code10"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'/'|| Remote Shutdown.vbs
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'|| Created by Harvey Hendricks, MCSE, A+,
</span><span style="color: #008000;">'|| March 2001
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'|| email: hhendrks@aramco.com
</span><span style="color: #008000;">'|| hhend@swbell.net
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'|| Based on techniques and ideas from:
</span><span style="color: #008000;">'|| SMS admin, SMS Installer, &amp; WMI forums -&gt; http://www.myITforum.com/forums
</span><span style="color: #008000;">'|| Win32 Scripting -&gt; http://cwashington.netreach.net/
</span><span style="color: #008000;">'|| Microsoft Windows Script Technologies -&gt; http://msdn.microsoft.com/scripting
</span><span style="color: #008000;">'|| Microsoft Online Library -&gt; http://msdn.microsoft.com/library/default.asp
</span><span style="color: #008000;">'|| Microsoft VBScript 5.5 documentation
</span><span style="color: #008000;">'|| and Microsoft WMI SDK
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</span><span style="color: #008000;">'|| SCRIPT LOGIC FLOW:
</span><span style="color: #008000;">'|| Collects computername from user, calls function to ping the computername
</span><span style="color: #008000;">'|| to determine if it is accessible, if not then display message and exit
</span><span style="color: #008000;">'|| otherwise continue.
</span><span style="color: #008000;">'|| Collects desired action to perform from the user, does error checking on
</span><span style="color: #008000;">'|| the input to determine if it is acceptable, if not then display message
</span><span style="color: #008000;">'|| and exit otherwise continue.
</span><span style="color: #008000;">'|| Set variables and output messages based on the action chosen. Calls
</span><span style="color: #008000;">'|| Win32Shutdown with the appropriate variable. Displays success message
</span><span style="color: #008000;">'|| and exits
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'|| Uses WMI Win32Shutdown method from the Win32_OperatingSystem class
</span><span style="color: #008000;">'|| to perform different logoff / powerdown / reboot functions
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'|| Testing found the following values to be effective on Win32Shutdown:
</span><span style="color: #008000;">'|| Action decimal binary
</span><span style="color: #008000;">'|| Logoff 0 0000
</span><span style="color: #008000;">'|| Force Logoff 4 0100
</span><span style="color: #008000;">'|| Reboot 2 0010
</span><span style="color: #008000;">'|| Force Reboot 6 0110
</span><span style="color: #008000;">'|| Powerdown 8 1000
</span><span style="color: #008000;">'|| Force Powerdown 12 1100
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'|| Notice that the third bit from the right appears to be the &quot;FORCE&quot; bit.
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'|| A value of 1 will do a shutdown, ending at the &quot;It is safe to turn
</span><span style="color: #008000;">'|| off your computer&quot; screen. I have no use for this and did not test it.
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'||NOTES: - tested under Windows 2000 Pro. with ACPI compliant systems -
</span><span style="color: #008000;">'|| SHOULD work under Windows NT4 without modification IF the
</span><span style="color: #008000;">'|| system has compatible versions of WSH / WMI / VBscripting
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'||Logoff / Powerdown / Reboot:
</span><span style="color: #008000;">'|| Does not work if a password protected screen saver is active or
</span><span style="color: #008000;">'|| there is data to save. Either way the system waits for user input.
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'||Force Logoff / Force Powerdown / Force Reboot:
</span><span style="color: #008000;">'|| Does not work if a password protected screen saver is active, will wait
</span><span style="color: #008000;">'|| for user input. Otherwise will close open applications without saving data.
</span><span style="color: #008000;">'||
</span><span style="color: #008000;">'\/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</span>
&nbsp;
<span style="color: #008000;">'/\/\/\/\/\/\/\/\/\/\/\/\/\/\ start function /\/\/\/\/\/\/\/\/\/\/\/\/\/'\/\/\/\/\/\/\/\/\/\/\/\/\/\/\______________/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
</span><span style="color: #000080;">function</span> Ping(<span style="color: #000080;">byval</span> strName)
<span style="color: #000080;">dim</span> objFSO, objShell, objTempFile, objTS
<span style="color: #000080;">dim</span> sCommand, sReadLine
<span style="color: #000080;">dim</span> bReturn
&nbsp;
<span style="color: #000080;">set</span> objShell = WScript.CreateObject(<span style="color: #800000;">&quot;Wscript.Shell&quot;</span>)
<span style="color: #000080;">set</span> objFSO = CreateObject(<span style="color: #800000;">&quot;Scripting.FileSystemObject&quot;</span>)
&nbsp;
<span style="color: #008000;">'Set default return value
</span>bReturn = <span style="color: #000080;">false</span>
&nbsp;
<span style="color: #008000;">'Create command line to ping and save results to a temp file
</span>sCommand = <span style="color: #800000;">&quot;cmd /c ping.exe -n 3 -w 1000 &quot;</span> &amp; strName &amp; <span style="color: #800000;">&quot; &gt; temp.txt&quot;</span>
&nbsp;
<span style="color: #008000;">'Execute the command
</span>objShell.run sCommand, 0, <span style="color: #000080;">true</span>
&nbsp;
<span style="color: #008000;">'Get the temp file
</span><span style="color: #000080;">set</span> objTempFile = objFSO.GetFile(<span style="color: #800000;">&quot;temp.txt&quot;</span>)
<span style="color: #000080;">set</span> objTS = objTempFile.OpenAsTextStream(1)
&nbsp;
<span style="color: #008000;">'Loop through the temp file to see if &quot;reply from&quot; is found,
</span><span style="color: #008000;">'if it is then the ping was successful
</span><span style="color: #000080;">do</span> <span style="color: #000080;">while</span> objTs.AtEndOfStream &lt;&gt; <span style="color: #000080;">true</span>
sReadLine = objTs.ReadLine
<span style="color: #000080;">if</span> instr(lcase(sReadLine), <span style="color: #800000;">&quot;reply from&quot;</span>) &gt; 0 <span style="color: #000080;">then</span>
bReturn = <span style="color: #000080;">true</span>
<span style="color: #000080;">exit</span> <span style="color: #000080;">do</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">loop</span>
&nbsp;
<span style="color: #008000;">'Close temp file and release objects
</span>objTS.<span style="color: #000080;">close</span>
objTempFile.delete
<span style="color: #000080;">set</span> objTS = <span style="color: #000080;">nothing</span>
<span style="color: #000080;">set</span> objTempFile = <span style="color: #000080;">nothing</span>
<span style="color: #000080;">set</span> objShell = <span style="color: #000080;">nothing</span>
<span style="color: #000080;">set</span> objFSO = <span style="color: #000080;">nothing</span>
&nbsp;
<span style="color: #008000;">'Return value
</span>Ping = bReturn
<span style="color: #000080;">end</span> <span style="color: #000080;">function</span>
<span style="color: #008000;">'/\/\/\/\/\/\/\/\/\/\/\/\/\/\ end function /\/\/\/\/\/\/\/\/\/\/\/\/\/'\/\/\/\/\/\/\/\/\/\/\/\/\/\/\______________/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
</span>
&nbsp;
&nbsp;
<span style="color: #008000;">'/\/\/\/\/\/\/\/\/\/\/\ Start Main body of script /\/\/\/\/\/\/\/\/\/\/\/'\/\/\/\/\/\/\/\/\/\/\/\_________________________/\/\/\/\/\/\/\/\/\/\/\/\/
</span><span style="color: #008000;">'Get computer name to operate on
</span>ComputerName=InputBox(<span style="color: #800000;">&quot;Enter the Machine name of the computer&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot;you wish to Shutdown / Reboot / Logoff&quot;</span>, _
<span style="color: #800000;">&quot;Remote Shutdown / Reboot / Logoff&quot;</span>, _
<span style="color: #800000;">&quot;ComputerName&quot;</span>)
&nbsp;
<span style="color: #008000;">'if Cancel selected - exit
</span><span style="color: #000080;">If</span> (ComputerName = <span style="color: #800000;">&quot;&quot;</span>) <span style="color: #000080;">Then</span> Wscript.Quit
&nbsp;
<span style="color: #008000;">'change the name to uppercase
</span>ComputerName=UCase(ComputerName)
&nbsp;
<span style="color: #008000;">'ping the computername to see if it is accessible
</span>bPingtest = ping(Computername)
&nbsp;
<span style="color: #000080;">If</span> bPingtest = <span style="color: #000080;">FALSE</span> <span style="color: #000080;">Then</span>
y = msgbox (<span style="color: #800000;">&quot;'&quot;</span> &amp; ComputerName &amp; <span style="color: #800000;">&quot;' is not accessible!&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot;It may be offline or turned off.&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot;Check the name for a typo.&quot;</span> &amp; vbCRLF, _
vbCritical, ComputerName &amp; <span style="color: #800000;">&quot; NOT RESPONDING&quot;</span>)
Wscript.Quit
<span style="color: #000080;">end</span> <span style="color: #000080;">IF</span>
&nbsp;
<span style="color: #008000;">'Get the action desired
</span>Action=InputBox( _
<span style="color: #800000;">&quot;Select Action to perform on &quot;</span> &amp; ComputerName &amp; vbCRLF &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot; 1 - Logoff&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot; 2 - Force Logoff ( NO SAVE )&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot; 3 - Powerdown&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot; 4 - Force Powerdown ( NO SAVE )&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot; 5 - Reboot&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot; 6 - Force Reboot ( NO SAVE )&quot;</span> &amp; vbCRLF &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot;NOTE:&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot; Using Force will close windows&quot;</span> &amp; vbCRLF _
&amp; <span style="color: #800000;">&quot; without saving changes!&quot;</span>, _
<span style="color: #800000;">&quot;Select action to perform on &quot;</span> &amp; ComputerName, <span style="color: #800000;">&quot;&quot;</span>)
&nbsp;
<span style="color: #008000;">'if Cancel selected - exit
</span><span style="color: #000080;">If</span> (Action = <span style="color: #800000;">&quot;&quot;</span>) <span style="color: #000080;">Then</span> Wscript.Quit
&nbsp;
<span style="color: #008000;">'error check input
</span><span style="color: #000080;">If</span> (INSTR(<span style="color: #800000;">&quot;1234567&quot;</span>,Action)=0) <span style="color: #000080;">OR</span> (Len(Action)&gt;1) <span style="color: #000080;">then</span>
y = msgbox(<span style="color: #800000;">&quot;Unacceptable input passed -- '&quot;</span> &amp; Action &amp; <span style="color: #800000;">&quot;'&quot;</span>, _
vbOKOnly + vbCritical, <span style="color: #800000;">&quot;That was SOME bad input!&quot;</span>)
Wscript.Quit
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
&nbsp;
<span style="color: #008000;">' set flag to disallow action unless proper input is achieved, 1 =&gt; go 0 =&gt; nogo
</span>flag = 0
&nbsp;
<span style="color: #008000;">'set variables according to computername and action
</span><span style="color: #000080;">Select</span> <span style="color: #000080;">Case</span> Action
<span style="color: #000080;">Case</span> 1 <span style="color: #008000;">'Logoff
</span>x = 0
strAction = <span style="color: #800000;">&quot;Logoff sent to &quot;</span> &amp; ComputerName
flag = 1
<span style="color: #000080;">Case</span> 2 <span style="color: #008000;">'Force Logoff
</span>x = 4
strAction = <span style="color: #800000;">&quot;Force Logoff sent to &quot;</span> &amp; ComputerName
flag = 1
<span style="color: #000080;">Case</span> 3 <span style="color: #008000;">'Powerdown
</span>x = 8
strAction = <span style="color: #800000;">&quot;Powerdown sent to &quot;</span> &amp; ComputerName
flag = 1
<span style="color: #000080;">Case</span> 4 <span style="color: #008000;">'Force Powerdown
</span>x = 12
strAction = <span style="color: #800000;">&quot;Force Powerdown sent to &quot;</span> &amp; ComputerName
flag = 1
<span style="color: #000080;">Case</span> 5 <span style="color: #008000;">'Reboot
</span>x = 2
strAction = <span style="color: #800000;">&quot;Reboot sent to &quot;</span> &amp; ComputerName
flag = 1
<span style="color: #000080;">Case</span> 6 <span style="color: #008000;">'Force Reboot
</span>x = 6
strAction = <span style="color: #800000;">&quot;Force Reboot sent to &quot;</span> &amp; ComputerName
flag = 1
<span style="color: #000080;">Case</span> 7 <span style="color: #008000;">'Test dialog boxes
</span>y = msgbox(<span style="color: #800000;">&quot;Test complete&quot;</span>, vbOKOnly + vbInformation, <span style="color: #800000;">&quot;Dialog Box Test Complete&quot;</span>)
flag = 0
<span style="color: #000080;">Case</span> <span style="color: #000080;">Else</span> <span style="color: #008000;">'Default -- should never happen
</span>y = msgbox(<span style="color: #800000;">&quot;Error occurred in passing parameters.&quot;</span> _
&amp; vbCRLF &amp; <span style="color: #800000;">&quot; Passed '&quot;</span> &amp; Action &amp; <span style="color: #800000;">&quot;'&quot;</span>, _
vbOKOnly + vbCritical, <span style="color: #800000;">&quot;PARAMETER ERROR&quot;</span>)
flag = 0
<span style="color: #000080;">End</span> <span style="color: #000080;">Select</span>
&nbsp;
<span style="color: #008000;">'check flag
</span><span style="color: #008000;">' if equal 1 (TRUE) then perform Win32Shutdown action on remote PC
</span><span style="color: #008000;">' and display a confirmation message
</span><span style="color: #008000;">' if not equal 1 (FALSE) then skip the action and script ends
</span><span style="color: #000080;">if</span> flag <span style="color: #000080;">then</span>
<span style="color: #000080;">Set</span> OpSysSet=GetObject(<span style="color: #800000;">&quot;winmgmts:{(Debug,RemoteShutdown)}//&quot;</span> _
&amp; ComputerName &amp; <span style="color: #800000;">&quot;/root/cimv2&quot;</span>).ExecQuery( _
<span style="color: #800000;">&quot;Select * from Win32_OperatingSystem where Primary=true&quot;</span>)
<span style="color: #000080;">for</span> <span style="color: #000080;">each</span> OpSys <span style="color: #000080;">in</span> OpSysSet
OpSys.Win32Shutdown(x)
y = msgbox(strAction,vbOKOnly + vbInformation,<span style="color: #800000;">&quot;Mission Accomplished&quot;</span>)
<span style="color: #000080;">next</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">If</span>
&nbsp;
<span style="color: #008000;">'Release objects
</span><span style="color: #000080;">set</span> OpSys = <span style="color: #000080;">nothing</span>
<span style="color: #000080;">set</span> OpSysSet = <span style="color: #000080;">nothing</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/04/remote-shutdown-logoff-script-using-wmi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

