<?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; Security</title>
	<atom:link href="http://www.waynezim.com/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.waynezim.com</link>
	<description>My World of Tech, Life and Anything Else</description>
	<lastBuildDate>Thu, 11 Mar 2010 05:02:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>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>0</slash:comments>
		</item>
		<item>
		<title>Weekly Terminal Services Connection Report using VBS</title>
		<link>http://www.waynezim.com/2009/06/weekly-terminal-services-connection-report-using-vbs/</link>
		<comments>http://www.waynezim.com/2009/06/weekly-terminal-services-connection-report-using-vbs/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 15:47:14 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Event Log]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Remote Administration]]></category>
		<category><![CDATA[Remote Desktop Connection]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[Terminal Services]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[VBscript]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=314</guid>
		<description><![CDATA[A few weeks ago we had some state auditors come by and mention that we should review our logs for any sort of outside / vendor access. I knew that going to each server and reviewing the logs manually would be very time consuming and not really provide solid documentation that it was done. I [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago we had some state auditors come by and mention that we should review our logs for any sort of outside / vendor access. I knew that going to each server and reviewing the logs manually would be very time consuming and not really provide solid documentation that it was done. I decided that the only way to solve this problem was with a report of some nature. I fired up my trusty Crystal Reports and started to view the logs using that, once I got in to more I realized that when I added the description field of the event log it always crashed Crystal Reports. This left me going to plan B which is writing the reports from scratch using Visual Basic Scripting language.</p>
<p>I already knew that you can use VBS to connect to WMI (Windows Management Interface) and view different parts of the system including the event log, so I spent the morning writing the report and parsing it down to the detail that I really needed. Then I decided to take it to the next level by adding in recursion for multiple servers and also set it up to send an HTML email so it is easy to review every week. Why every week you may ask, well in looking at my event log on my domain server I noticed that I start losing Security events at about 10-14 days out since it is authorizing so much, and a weekly task is a very manageable one.</p>
<p><b>Script Configuration</b></p>
<ol>
<li>Configure the servers that this script will report on. Modify the <em>Servers</em> array for each server that needs to be checked. (Note: all servers need the same login credentials for the script to work)</li>
<li>Find the <em>objMessage.From</em> field and update it with who the email is coming from</li>
<li>Find the <em>objMessage.To</em> Field and update with the email address of the person who will be receiving the report, if you have multiple addresses to send to separate them with a semi-colon (;)</li>
<li>Find the <em>(&#8220;http://schemas.microsoft.com/cdo/configuration/smtpserver&#8221;) = &#8220;smtp-relay.waynezim.com&#8221;</em> and update this with your SMTP server, if your server requires authentication you will need to modify this script to include that, a simple Google search should show you what needs to be changed.</li>
<li>This script should be setup to be a scheduled task on one of your servers, the credentials used in setting up the job will be used to connect to the other servers, this account needs to exist on all servers to view the Security Event Log and make the report.</li>
<li>To setup a scheduled task, go to your <em>Control Panel</em>, open <em>Scheduled Tasks</em>, right click <em>New > Scheduled Task</em>, name it, then right click and modify the <em>Properties</em>, <em>Browse</em> to where the script is saved, set the <em>Run as</em> at the bottom for the user that exists on all Servers and set the password. Then go to the <em>Schedule</em> tab and set it to <em>Weekly</em> and change it to run when you want it to.</li>
</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=314&amp;download=RemoteConnectionsReport.vbs">RemoteConnectionsReport.vbs</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3142"><td class="code" id="p314code2"><pre class="vbs" style="font-family:monospace;">Dim objWMI, objEvent ' Objects
Dim strComputer ' Strings
Dim intEvent, intNumberID, intRecordNum, colLoggedEvents
'--------------------------------------------
' Server List to Parse Logs
Dim Servers(5)
Servers(0) = &quot;server1&quot;
Servers(1) = &quot;server2&quot;
Servers(2) = &quot;server3&quot;
Servers(3) = &quot;server4&quot;
Servers(4) = &quot;server5&quot;
Servers(5) = &quot;server6&quot;
'--------------------------------------------
' Email Body Heading
HTMLMsg = &quot;&lt;html&gt;&lt;body&gt;&lt;h3&gt;Remote Desktop Connections from &quot; &amp; cDate(Now() - 7) &amp; &quot; to &quot; &amp; cDate(Now()) &amp; &quot;&lt;/h3&gt;&quot;
HTMLMsg = HTMLMsg &amp; &quot;&lt;table border=1&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Computer Name&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Logon Type&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Remote IP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Date / Time&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;User&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&quot;
'--------------------------------------------
' Next section creates the file to store Events
' Then creates WMI connector to the Logs
&nbsp;
'Range Variable - Out of Loop for Common Report Time
WeekAgo = cDate(Now() - 7)
&nbsp;
'Start Each Computer Loop
For Each strComputer in Servers
' --------------------------------------------
' Set your variables for Events Loop
intEvent = 1
intRecordNum = 1
&nbsp;
Set objWMI = GetObject(&quot;winmgmts:&quot; _
&amp; &quot;{impersonationLevel=impersonate}!\\&quot; _
&amp; strComputer &amp; &quot;\root\cimv2&quot;)
Set colLoggedEvents = objWMI.ExecQuery _
(&quot;Select * from Win32_NTLogEvent Where Logfile = 'Security' AND EventCode = 528 AND TimeWritten &gt; '&quot; &amp; WeekAgo &amp; &quot;'&quot;)
' -----------------------------------------
' Next section loops through ID properties
intEvent = 1
	For Each objEvent in colLoggedEvents
&nbsp;
	HTMLMsg = HTMLMsg &amp; &quot;&lt;tr&gt;&lt;td&gt;&quot; &amp; objEvent.ComputerName &amp; &quot;&lt;/td&gt;&quot;
	LogonType = RTrim(Mid(objEvent.Message,InStr(objEvent.Message,&quot;Logon Type:&quot;)+12,2))
	If LogonType = 2 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;Interactive&lt;/td&gt;&quot; End if
	If LogonType = 3 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;Network&lt;/td&gt;&quot; End if
	If LogonType = 4 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;Batch&lt;/td&gt;&quot; End if
	If LogonType = 5 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;Service&lt;/td&gt;&quot; End if
	If LogonType = 7 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;Unlock&lt;/td&gt;&quot; End if
	If LogonType = 8 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;Network using Clear Text&lt;/td&gt;&quot; End if
	If LogonType = 9 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;New Credentials&lt;/td&gt;&quot; End if
	If LogonType = 10 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;Remote Interactive&lt;/td&gt;&quot; End if
	If LogonType = 11 Then HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;Cached Interaction&lt;/td&gt;&quot; End if
&nbsp;
	IPlen = InStr(InStr(objEvent.Message,&quot;Source Network Address:&quot;)+24,objEvent.Message,&quot;	&quot;) - InStr(objEvent.Message,&quot;Source Network Address:&quot;) - 28
	RemoteAddress = RTrim(Mid(objEvent.Message,InStr(objEvent.Message,&quot;Source Network Address:&quot;)+24,IPlen))
	HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;&quot; &amp; RemoteAddress &amp; &quot;&lt;/td&gt;&quot;
	EventTime = Mid(objEvent.TimeWritten, 5, 2) &amp; &quot;/&quot; &amp; Mid(objEvent.TimeWritten, 7, 2) &amp; &quot;/&quot; &amp; Mid(objEvent.TimeWritten, 1, 4) &amp; &quot; &quot; &amp; Mid(objEvent.TimeWritten, 9, 2) &amp; &quot;:&quot; &amp; Mid(objEvent.TimeWritten, 11, 2) &amp; &quot;.&quot; &amp; Mid(objEvent.TimeWritten, 13, 2)
	HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;&quot; &amp; EventTime &amp; &quot;&lt;/td&gt;&quot;
	HTMLMsg = HTMLMsg &amp; &quot;&lt;td&gt;&quot; &amp; objEvent.User &amp; &quot;&lt;/td&gt;&lt;/tr&gt;&quot;
	intRecordNum = intRecordNum +1
	IntEvent = intEvent +1
&nbsp;
	Next
Next
&nbsp;
Set objMessage = CreateObject(&quot;CDO.Message&quot;)
objMessage.Subject = &quot;Remote Connections Report: &quot; &amp; cDate(Now())
objMessage.From = &quot;root@waynezim.com&quot;
objMessage.To = &quot;waynezim@waynezim.com&quot;
objMessage.HTMLBody = HTMLMsg
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
(&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;smtp-relay.waynezim.com&quot;
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
&nbsp;
objMessage.Send
WScript.Quit</pre></td></tr></table></div>

<p><b>Report Preview</b><br />
If you need help decoding what Logon Type really means check out this <a href="http://www.windowsecurity.com/articles/Logon-Types.html">great article. </a></p>
<table border=0>
<tr>
<td>
<a href="http://www.waynezim.com/wp-content/uploads/2009/06/remote-connection-report-preview.png"><img src="http://www.waynezim.com/wp-content/uploads/2009/06/remote-connection-report-preview.png" alt="remote-connection-report-preview" title="remote-connection-report-preview" width="675" height="253" class="alignleft size-full wp-image-324" /></a></td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.waynezim.com/2009/06/weekly-terminal-services-connection-report-using-vbs/feed/</wfw:commentRss>
		<slash:comments>0</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>7</slash:comments>
		</item>
		<item>
		<title>List Local Accounts from Computers in Active Directory</title>
		<link>http://www.waynezim.com/2009/04/list-local-accounts-from-computers-in-active-directory/</link>
		<comments>http://www.waynezim.com/2009/04/list-local-accounts-from-computers-in-active-directory/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 14:46:11 +0000</pubDate>
		<dc:creator>Wayne Zimmerman</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[compmgmt.msc]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[User Accounts]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[VBscript]]></category>

		<guid isPermaLink="false">http://www.waynezim.com/?p=12</guid>
		<description><![CDATA[When you finally take the plunge and decided that the only way to take your business to the next level is to setup a true client/server environment, here is a script to help you clean up those old accounts. When you convert to an Active Directory structure, you need to remove all the old local [...]]]></description>
			<content:encoded><![CDATA[<p>When you finally take the plunge and decided that the only way to take your business to the next level is to setup a true client/server environment, here is a script to help you clean up those old accounts. When you convert to an Active Directory structure, you need to remove all the old local user accounts. This will reduce the security risks by removing accounts that you can&#8217;t force to conform to the rules setup by Group Policy. Also, if you were running these users as Administrators or Power Users and now have limited them down to a Standard user, without removing their old local accounts they may have elevated rights that they don&#8217;t need. Using this script you can query every computer in you Active Directory and get a list in CSV that you can use to know where that accounts are that need to be removed. In this script you can modify the output file so you can save the file where you want. You will also need to modify the Active Directory information to match your Domain configuration.</p>
<p>Tip: You can remotely connect other computers on your domain using &#8220;compmgmt.msc /computer:[remote computer]&#8221; from there you can manage user accounts in Local Users and Groups.</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=12&amp;download=getlocalaccts.vbs">getlocalaccts.vbs</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p124"><td class="code" id="p12code4"><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;MYDomainController&quot;</span> <span style="color: #008000;">'put domain controller here
</span>
<span style="color: #000080;">Set</span> objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
    <span style="color: #800000;">&quot;Select Name, Location from LDAP://DC=subdomain,DC=zim,DC=local' &quot;</span> _  <span style="color: #008000;">'update this with your AD information
</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
	LocalUsers objRecordSet.Fields(<span style="color: #800000;">&quot;Name&quot;</span>).Value, <span style="color: #800000;">&quot;C:\localaccounts.csv&quot;</span> <span style="color: #008000;">'adjust output file name as needed
</span>    objRecordSet.MoveNext
<span style="color: #000080;">Loop</span>
&nbsp;
<span style="color: #000080;">Sub</span> LocalUsers(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> colAccounts = GetObject(<span style="color: #800000;">&quot;WinNT://&quot;</span> &amp; strComputer)
		colAccounts.Filter = Array(<span style="color: #800000;">&quot;user&quot;</span>)
&nbsp;
		<span style="color: #000080;">For</span> <span style="color: #000080;">Each</span> objUser <span style="color: #000080;">In</span> colAccounts
		        logStream.writeline(strComputer &amp; <span style="color: #800000;">&quot;,Online,&quot;</span> &amp; objUser.Name &amp; <span style="color: #800000;">&quot;,&quot;</span> &amp; objUser.AccountDisabled) 
		<span style="color: #000080;">Next</span>
	<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
	logStream.<span style="color: #000080;">Close</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/list-local-accounts-from-computers-in-active-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
