<?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>ElectroNerdz Tech Blog</title>
	<atom:link href="http://www.electronerdz.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.electronerdz.com</link>
	<description>Technology tips and news in the eyes of a nerd.</description>
	<lastBuildDate>Mon, 25 Mar 2013 14:49:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Trusted Domain Exchange Environment</title>
		<link>http://www.electronerdz.com/2013/03/trusted-domain-exchange-environment/</link>
		<comments>http://www.electronerdz.com/2013/03/trusted-domain-exchange-environment/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 14:49:59 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Exchange]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=98</guid>
		<description><![CDATA[In the health system I work for, we have been tasked with taking our old AD domain and making it work within the new domain. Eventually, all computers will be converted to the new domain, but there are steps along &#8230; <a href="http://www.electronerdz.com/2013/03/trusted-domain-exchange-environment/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In the health system I work for, we have been tasked with taking our old AD domain and making it work within the new domain. Eventually, all computers will be converted to the new domain, but there are steps along the way before that date. One of those stages was to use Exchange from the other domain. We will call this DomainB.com. The domain here at our local hospital is DomainA.com.<br />
<span id="more-98"></span><br />
We have a trust relationship between DomainA and DomainB. This allows DomainA computers to authenticate against DomainB. However, it isn&#8217;t without its issues. When adding Exchange accounts from DomainB into DomainA while still logging into DomainA, Outlook doesn&#8217;t play well. The first problem we had was AutoDiscover. AutoDiscover isn&#8217;t quite setup correctly on at DomainB as the normal search pattern for the discovery won&#8217;t find the autodiscover.xml file with the way the domains are named. And with the trust, SCP doesn&#8217;t work correctly. The second problem is passwords. We had to add the password for DomainB into the password vault in Windows 7 (similar to Windows XP). The third problem was the Out-Of-Office (OOF) and Availability Services (AS). Both of these did not work. For the last two months, we have been telling our users that it won&#8217;t work until we are in DomainB so they will have to use OWA for those features.</p>
<p>Thursday last week, my CEO pulled me into his office and asked if there was anything that could be done for the Free/Busy (FB) information. I told him the same speel I have been telling everyone else. Gotta wait for DomainB. All night I started crunching ideas. Over the course of Friday and Monday, I finally solved it. All services are now working. So, on to how I did it&#8230;</p>
<h3>AutoDiscover</h3>
<p>The IT department of DomainB wasn&#8217;t particularly helpful and was giving me the same speel I was giving everyone else. Because the OWA URL used a non-standard URL, AutoDiscover would never find the XML file. If you were on DomainB, it would find it via SCP (Service Connection Point). But since we are on DomainA, we don&#8217;t have rights to DomainB&#8217;s SCPs. So I found a way to force Outlook 2010 to use a local XML file.</p>
<p>HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\AutoDiscover\&#8221;PreferLocalXML&#8221;=dword:1<br />
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\AutoDiscover\&#8221;DomainB.com&#8221;=&#8221;\\path\to\file.xml&#8221;</p>
<p>Since AutoDiscover.xml is dynamically generated upon viewing, you can&#8217;t really just copy and paste the contents from the real file. You have to redirect.</p>
<pre class="brush: xml; title: ; notranslate">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; 
&lt;Autodiscover xmlns=&quot;http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006&quot;&gt; 
  &lt;Response xmlns=&quot;http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a&quot;&gt; 
    &lt;Account&gt; 
      &lt;AccountType&gt;email&lt;/AccountType&gt; 
      &lt;Action&gt;redirectUrl&lt;/Action&gt; 
      &lt;RedirectUrl&gt;https://remote.DomainB.com/autodiscover/autodiscover.xml&lt;/RedirectUrl&gt; 
    &lt;/Account&gt; 
  &lt;/Response&gt; 
&lt;/Autodiscover&gt;</pre>
<p>This works by responding back with all the URLs necessary for OOF, FB, AS, etc. This is of course assuming that the Exchange server is correct and has FQDNs. This also pulled other settings such as Personal Archive folders.</p>
<p>Once Outlook reads from this file when setting up an email account, everything is built out without the need for further configuration in Outlook.</p>
<h3>Passwords</h3>
<p>This one is simple. In the password vault of Windows 7 (or the password area in XP), add your Exchange servers CAS and Mailbox servers manually. Be sure to use the credentials from DomainB. The &#8220;Save password&#8221; checkbox may not work.</p>
<h3>OOF and Availability Services</h3>
<p>Actually, this one is easy too if you did the same from above. Our paticular DomainB had a &#8220;web.DomainB.com&#8221; and a &#8220;mailbox.DomainB.com&#8221; and &#8220;cas.DomainB.com&#8221; so I added all three in which case, OOF and AS are now working.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2013/03/trusted-domain-exchange-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find Your Adobe Acrobat Serial Number</title>
		<link>http://www.electronerdz.com/2012/07/find-your-adobe-acrobat-serial-number/</link>
		<comments>http://www.electronerdz.com/2012/07/find-your-adobe-acrobat-serial-number/#comments</comments>
		<pubDate>Wed, 11 Jul 2012 20:35:24 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=83</guid>
		<description><![CDATA[On our network, we have quite a few computers that have Adobe Acrobat Standard installed on them. Unfortunately, we don&#8217;t know which ones match what serial numbers. So I set out to find out how. First, you would think you &#8230; <a href="http://www.electronerdz.com/2012/07/find-your-adobe-acrobat-serial-number/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>On our network, we have quite a few computers that have Adobe Acrobat Standard installed on them. Unfortunately, we don&#8217;t know which ones match what serial numbers. So I set out to find out how.</p>
<p><span id="more-83"></span></p>
<p>First, you would think you could find it in the registry. This may have been possible with older versions, but with 9.0+ (and possibly lower, I just haven&#8217;t checked), it is not saved in the registry.</p>
<p>There is a software product called <a href="http://recover-keys.com/">Recover Keys</a> that will do this for you, but it needs to be purchased and their demo will not show the entire key. This program will even search the whole network for you, but at a much higher cost. So I set out to find out HOW this program found the serial number. Using ProcMon, I discovered that it searched all over the registry, then it started to search Adobe folders. It came across this file:</p>
<p><code>C:\Program Files (x86)\Common Files\Adobe\Adobe PCD\cache\cache.db</code></p>
<div style="text-align: right"><em>omit the (x86) for 32-bit</em></div>
<p>It turns out that this file is a SQLite database. Using an SQLite browser, sure enough, there was my serial number. Here is how to find the serial:</p>
<pre class="brush: sql; title: ; notranslate">SELECT value FROM domain_data WHERE key = 'LineCU 4';</pre>
<p>It should spit out your serial number. Using these two steps, it should be possible to write a program that finds the cache.db folder on the computer then reads the value out of. I will be investigating doing this on our network programmaticly.</p>
<p>I checked this against Adobe Acrobat 9 Pro, and it was the same. However, on Adobe Acrobat 8 Standard, the key is different. Here it is:</p>
<pre class="brush: sql; title: ; notranslate">SELECT value FROM domain_data WHERE key = 'EPIC_SERIAL';</pre>
<p>I hope this helps you. I may be designing an application that you can point at a computer name and it returns the serial. I&#8217;ll post it up here if I do.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2012/07/find-your-adobe-acrobat-serial-number/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Nortel CallPilot LDAP Lookup</title>
		<link>http://www.electronerdz.com/2011/11/nortel-callpilot-ldap-lookup/</link>
		<comments>http://www.electronerdz.com/2011/11/nortel-callpilot-ldap-lookup/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 14:13:16 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=78</guid>
		<description><![CDATA[Where I work right now, they use a Nortel phone system. For voicemail, they use CallPilot. The CallPilot system happens to be on the network, which is rather intriguing. For the department I am in, we use an Asterisk phone &#8230; <a href="http://www.electronerdz.com/2011/11/nortel-callpilot-ldap-lookup/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Where I work right now, they use a Nortel phone system. For voicemail, they use CallPilot. The CallPilot system happens to be on the network, which is rather intriguing. For the department I am in, we use an Asterisk phone system that talks to the Nortel. I&#8217;ve always wondered however if there was an phone directory of the extensions. I was told no. So I did some digging. I happened across and LDAP server running on the CallPilot system. After some hacking, I discovered that the LDAP system had all the names in it (outdated of course). Two caveats though: it is only the extensions which have voicemail and it is using LDAP 2.0.</p>
<p><span id="more-78"></span></p>
<p>So come to find out, no one makes a free LDAP browser that actually supports version 2.0, and certainly none that will talk to the hacked version on the CallPilot system. LDAP 2.0 is ancient as I heard it quoted on one website. But, PHP supports 2.0. So I took my <a href="/2011/08/active-directory-lookup-in-php/">Active Directory lookup script</a>, and modified it for use with CallPilot. I&#8217;ve posted a script below that you can use if you&#8217;d like to do lookups against this directory. It uses any voicemail user and password (I used mine for instance). Next, I may be playing with the IMAP server that appears to be running on the CallPilot system. That should prove interesting&#8230;</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

// Specify server settings here
$CP_Server=&quot;0.0.0.0&quot;; // Enter the IP address of your CallPilot System
$CP_User=&quot;mail=12345671111@CALLPILOT.domain.com,dc=nortel,dc=ca&quot;; // The extention was prefixed with the VPIM
$CP_Password=&quot;&quot;; // Password for voicemail box
$CP_Root=&quot;addressbook=user,dc=nortel,dc=ca&quot;; // You should probably leave this alone

function connectLDAP($server,$user,$password) {

	// Issue the connect command
	$cp_connect=ldap_connect($server) or
	die (&quot;Could not connect to LDAP&quot;);

	// These options are required for MS Active Directory
	ldap_set_option($cp_connect, LDAP_OPT_PROTOCOL_VERSION, 2);
	ldap_set_option($cp_connect, LDAP_OPT_REFERRALS, 0);

	// Bind to AD with the username and password
	$ds_connect = ldap_bind($cp_connect,$user,$password) or
	die(&quot;Couldn't bind to CallPilot!&quot;);

	// Return handler
	return $cp_connect;

}

function disconnectLDAP($handle) {

	// Disconnect from the server
	ldap_unbind($handle);

}

function searchLDAP($ldap,$query,$root,$sort) {

	// Query the LDAP server
	// Future: Want adjust the array on the fly later, such as objectclass
	$sr=ldap_search($ldap, $root, $query);
	 
	// If a sort field was requested, adjust the list
	if ($sort) {
		$st=ldap_sort($ldap, $sr, $sort);
	}
	 
	// Generate the array, and return
	 
	$info = ldap_get_entries($ldap, $sr);
	 
	return $info;
 
}

// Start the script, check for extention
if ($_REQUEST[&quot;ext&quot;]) {
	$cp = connectLDAP($CP_Server,$CP_User,$CP_Password);
	$query = &quot;(&amp;(telephonenumber=&quot;.$_REQUEST[&quot;ext&quot;].&quot;))&quot;; // Put whatever you want here
	$sort = &quot;&quot;;

	$info = searchLDAP($cp, $query, $CP_Root, $sort);

	if ($info[&quot;count&quot;]&gt;0) {
		echo &quot;Name: &quot; . $info[0][&quot;givenname&quot;][0] . &quot; &quot; . $info[0][&quot;sn&quot;][0] . &quot; (&quot; . $info[0][&quot;cn&quot;][0] . &quot;)&lt;br /&gt;&quot;;
		echo &quot;Department: &quot; . $info[0][&quot;department&quot;][0] . &quot;&lt;br /&gt;&quot;;
		echo &quot;Extension: &quot; . $info[0][&quot;telephonenumber&quot;][0] . &quot;&lt;br /&gt;&lt;br /&gt;&quot;;
		echo &quot;&lt;pre&gt;&quot;;
		print_r($info); // print the array
		echo &quot;&lt;/pre&gt;&quot;;
	}
	else {
		echo &quot;No such user found for &quot; . $_REQUEST[&quot;ext&quot;] . &quot;.&quot;;
	}
	 
	disconnectLDAP($cp);
}
else {
	echo &quot;Please specify an extension.&quot;;
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2011/11/nortel-callpilot-ldap-lookup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AutoIT Scripting</title>
		<link>http://www.electronerdz.com/2011/11/autoit-scripting/</link>
		<comments>http://www.electronerdz.com/2011/11/autoit-scripting/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 20:38:23 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[AutoIT]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=70</guid>
		<description><![CDATA[A few months back, I had found a solution called AutoIT. I downloaded and installed it, and attempting to write a quick little program. At the time however, I really didn&#8217;t want to have to learn another scripting language as &#8230; <a href="http://www.electronerdz.com/2011/11/autoit-scripting/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>A few months back, I had found a solution called AutoIT. I downloaded and installed it, and attempting to write a quick little program. At the time however, I really didn&#8217;t want to have to learn another scripting language as I had already started getting heavily into VBScript. Just a week or so ago, I realized it was wrong of me to just throw it to the side. AutoIT and it&#8217;s scripting language is an amazing language, and is basically a BASIC language. It is incredibly easy to use, and very powerful. There are so many commands that are already built in, and on top of all that, you can compile it into a standard EXE file that doesn&#8217;t require any libraries. If you wanted to go crazy, you could even create a GUI. I&#8217;d like to say that I wish I had found this product years ago. I could have created a lot of powerful tools. If you are looking to script common actions, networked or not, try out <a href="http://www.autoitscript.com/site/">AutoIT</a>. Keep an eye here, as I will be posting some of my AU3 scripts here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2011/11/autoit-scripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Touch for HTTP in VB Script</title>
		<link>http://www.electronerdz.com/2011/10/touch-for-http-in-vb-script/</link>
		<comments>http://www.electronerdz.com/2011/10/touch-for-http-in-vb-script/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 20:30:33 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Visual Basic Script]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=63</guid>
		<description><![CDATA[There are times when I need a Windows program that performs an outside function to simply access a website with a particularly formed URL. Many times, these programs do not have an option to &#8220;touch&#8221; a URL. By touch, I &#8230; <a href="http://www.electronerdz.com/2011/10/touch-for-http-in-vb-script/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>There are times when I need a Windows program that performs an outside function to simply access a website with a particularly formed URL. Many times, these programs do not have an option to &#8220;touch&#8221; a URL. By touch, I am referencing the <a href="http://en.wikipedia.org/wiki/Touch_(Unix)">touch command</a> in Linux which creates an empty file. Sometimes I need to touch something like http://www.somewebsite.com/folder/update.php?q=Update. I could use wget for Windows, but why do that when I could use a built-in function of Windows. I wrote a VB Script that simply &#8220;gets&#8221; a URL and exits.</p>
<pre class="brush: vb; title: ; notranslate">
' httptouch.vbs
' Created by Jason C. Greb
' http://www.electronerdz.com/

Set Args = WScript.Arguments
URL = Args(0) ' Read argument (must be in quotes)
Set oHTTP = CreateObject(&quot;MSXML2.XMLHTTP&quot;)
oHTTP.Open &quot;GET&quot;, URL, False
oHTTP.Send() ' Send to the server
'Wscript.Echo oHTTP.Status ' Output the status if you'd like
Set oHTTP = Nothing
</pre>
<p>This script takes an argument after it, in quotes, and accesses that URL, then quits. You can add it to your program that runs an external program and put the argument after it. Keep in mind that you may need to reference the cscript.exe file (usually in system32) then the script, then the argument.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2011/10/touch-for-http-in-vb-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TimeKeeper over subnets</title>
		<link>http://www.electronerdz.com/2011/10/timekeeper-over-subnets/</link>
		<comments>http://www.electronerdz.com/2011/10/timekeeper-over-subnets/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 15:16:05 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=56</guid>
		<description><![CDATA[If you use Kronos TimeKeeper on a large network, you&#8217;ve probably had issues with running it in different subnets or VLANs. It says that it can&#8217;t find the database even though you have mapped the necessary drives. I&#8217;ve had those &#8230; <a href="http://www.electronerdz.com/2011/10/timekeeper-over-subnets/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>If you use Kronos TimeKeeper on a large network, you&#8217;ve probably had issues with running it in different subnets or VLANs. It says that it can&#8217;t find the database even though you have mapped the necessary drives. I&#8217;ve had those very issues, but apparently, TimeKeeper doesn&#8217;t have a way to fix it. I found a way today.</p>
<p>The best I can figure, TimeKeeper sends out a broadcast packet during the install to find out where the server is. On a subnetted network, this won&#8217;t help. TimeKeeper creates several ODBC entries during the install. In these entries, you manually specify the the server IP address. Go to SystemDSN in the ODBC control panel options. You will see three entries for TimeKeeper. Edit each one, and on the Network tab, add Host=[ipaddress] to the TCP/IP options where [ipaddress] is the IP address of the server TimeKeeper is installed. It should work beautifully after that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2011/10/timekeeper-over-subnets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stop calls about locked accounts</title>
		<link>http://www.electronerdz.com/2011/09/stop-calls-about-locked-accounts/</link>
		<comments>http://www.electronerdz.com/2011/09/stop-calls-about-locked-accounts/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 00:29:46 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Visual Basic Script]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=38</guid>
		<description><![CDATA[From time to time in a corporate network a user may lock out their account accidentally. In the corporate network that I am involved in there are generic accounts (unfortunately with dead simple passwords) that occasionally get locked. Since this &#8230; <a href="http://www.electronerdz.com/2011/09/stop-calls-about-locked-accounts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>From time to time in a corporate network a user may lock out their account accidentally. In the corporate network that I am involved in there are generic accounts (unfortunately with dead simple passwords) that occasionally get locked. Since this is a 24/7 operation, it can happen in the middle of the night (in fact, more common at night). So to ease this a bit, and be proactive, I decided to find a way to get an alert  every time an account gets locked. I of course, just used Windows easy to use built in feature. Oh wait, Windows doesn&#8217;t have that&#8230; Read on for how I did this&#8230;</p>
<p><span id="more-38"></span></p>
<p>I discovered this command called <a href="http://technet.microsoft.com/en-us/library/bb490901.aspx">eventtriggers.exe</a>. Apparently, its been in Windows since Windows XP (I couldn&#8217;t find it in Windows 7 though). Our domain controller is Windows 2003, but I am sure it is in Windows 2008 also. So I ran the following on the domain controller:</p>
<p><code>eventtriggers /create /tr EventID644 /l security /eid 644 /tk c:\tools\trigger.vbs</code></p>
<p>You will need to enter the password for the user that you are currently in. You could modify this command a bit and run as the system account I am sure, but I decided not to. This is create a Scheduled Task that runs every time the Event ID 644 is created. This event is the event that says an account has been locked. Another useful one is 675, which is when a user enters a wrong password. Unfortunately, I could not find an easy way to add arguments to the trigger.vbs file (in case I want to reuse the same command for other event IDs), so you can manually edit the task in Scheduled Tasks. I changed the command to the following:</p>
<p><code>c:\tools\trigger.vbs 644 "User Account Locked"</code></p>
<p>So now we need to create the trigger.vbs file. This file will read the data from the Event ID, and email it. Unfortunately, you can not pass the particular event that caused the issue to trigger.vbs via eventtriggers, so we will do some creative WMI reading. The code below searches for the passed event ID, but thankfully WMI starts with the newest first otherwise we&#8217;d get every event ID on the log. So we&#8217;ll just read the first one. Now of course, if two came in at the same time, and this script hadn&#8217;t started in the millisecond difference of the next event, you might read the wrong one. But seriously, how many accounts are being locked out during the day?</p>
<pre class="brush: vb; title: ; notranslate">
' Setup the variables
Dim Args, strMsg
Dim strEventID, strDesc
Dim objWMIService, colEvents, objItem
Dim Loops
Dim objMessage ' This one is very important!

' If there are no arguments, do nothing
Args = WScript.Arguments.Count
If Args &lt; 1 Then
	WScript.Echo &quot;Usage: trigger.vbs  &quot;&quot;&quot;&quot;&quot;
	WScript.Quit
End If

' Read in the arguments
strEventID = WScript.Arguments.Item(0)
strDesc = WScript.Arguments.Item(1)

' Connect to WMI and Query
Set objWMIService = GetObject(&quot;winmgmts:{(Security)}\\.\root\cimv2&quot;)
Set colEvents = objWMIService.ExecQuery(&quot;Select * From Win32_NTLogEvent Where &quot; &amp; _
	&quot;Logfile = 'Security' AND EventCode= '&quot; &amp; strEventID &amp; &quot;'&quot;)

' We are going to load the events, but only read the latest one
Loops = 0
For Each objItem in colEvents
	If Loops = 1 Then
		Exit For
	End If
	' Create the body of the email
	strMsg = Now &amp; vbCrLf &amp; vbCrLf ' Add the time to the message
	strMsg = strMsg &amp; &quot;Time Generated: &quot; &amp; objItem.TimeGenerated &amp; vbCrLf
	strMsg = strMsg &amp; &quot;Category: &quot; &amp; objItem.Category &amp; vbCrLf
	strMsg = strMsg &amp; &quot;Event Code: &quot; &amp; objItem.EventCode &amp; vbCrLf
	strMsg = strMsg &amp; &quot;Record Number: &quot; &amp; objItem.RecordNumber &amp; vbCrLf
	strMsg = strMsg &amp; &quot;Source Name: &quot; &amp; objItem.SourceName &amp; vbCrLf
	strMsg = strMsg &amp; &quot;Event Type: &quot; &amp; objItem.Type &amp; vbCrLf
	strMsg = strMsg &amp; &quot;Message: &quot; &amp; objItem.Message
	Loops = 1 ' Set the variable so it doesn't run again
Next

' Load CDO and create the message, then send it
Set objMessage = CreateObject(&quot;CDO.Message&quot;)
objMessage.Subject = &quot;AD Audit Event: &quot; &amp; strDesc ' Add the description to the subject
objMessage.From = &quot;support@company.com&quot;
objMessage.To = &quot;support@company.com&quot;
objMessage.TextBody = strMsg
' The commands below use SMTP to do the sending
objMessage.Configuration.Fields.Item( _
	&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
objMessage.Configuration.Fields.Item( _
	&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;smtp.company.com&quot;
objMessage.Configuration.Fields.Item( _
	&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25
objMessage.Configuration.Fields.Update
' Send the message
objMessage.Send

' Done
</pre>
<p>Now this particular file just reads from the Security event log file, but you could adjust this and read any type of event. You would have to adjust both winmgmts and the SQL statement and then modify the what items it reads from the the particular event.</p>
<p>That should do it. You could modify the trigger file to add this information to a database. For example, I will be modifying it to add 675 event IDs (wrong password) to a database, since I don&#8217;t want an email every 10 minutes, but I can view history leading up to a locked account.</p>
<p>Now of course, you&#8217;ll still get calls in the middle of the night if you were asleep when the email came in. But at least you can say that you already knew and were working on it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2011/09/stop-calls-about-locked-accounts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade from SharePoint Services 3.0 to SharePoint Foundation 2010 in 10 Steps</title>
		<link>http://www.electronerdz.com/2011/09/upgrade-from-sharepoint-services-3-0-to-sharepoint-foundation-2010-in-10-steps/</link>
		<comments>http://www.electronerdz.com/2011/09/upgrade-from-sharepoint-services-3-0-to-sharepoint-foundation-2010-in-10-steps/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 15:09:02 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=22</guid>
		<description><![CDATA[*Edit [11/23/2011]: Alright, if you tried these instructions before now, they probably didn&#8217;t work. I attempted this again, and found a lot of mistakes. I am reworking this now, and will be doing this one more time for good, so &#8230; <a href="http://www.electronerdz.com/2011/09/upgrade-from-sharepoint-services-3-0-to-sharepoint-foundation-2010-in-10-steps/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>*Edit [11/23/2011]: Alright, if you tried these instructions before now, they probably didn&#8217;t work. I attempted this again, and found a lot of mistakes. I am reworking this now, and will be doing this one more time for good, so I might make a few more minor changes.</p>
<p>I recently needed to move a SPS 3.0 server to a new Foundation 2010 server. Now, Microsoft posts several documents on how to do this, but I think we all know that their documents aren&#8217;t always that helpful. I first tried to move the Sharepoint to another server, then do an updgrade, but it did not go so smoothly. So I tried it again using the &#8220;database attach&#8221; method. I did a lot of Googling, and tried an unbelievable number of things before I finally got the upgrade to work. I&#8217;ve collected my steps here. Hopefully, I remembered everything correctly. There were what seemed like a lot of steps, but it mostly went smoothly. Read on for my guide to upgraded to SharePoint Foundation 2010 and I hope it helps you with your upgrade.<span id="more-22"></span></p>
<p><strong>Step 1: Preparation</strong><br />
The first step is to prepare your new server. In my case, I am using Windows 2008 R2 64-bit. There are several things you will need to download to get started, and have them all available and ready to go. I am listing them here, so that you will be ready:<br />
<a href="http://www.microsoft.com/download/en/details.aspx?id=5970">Microsoft SharePoint Foundation Server 2010</a><br />
<a href="http://www.microsoft.com/download/en/details.aspx?id=7593">Microsoft SQL Server 2008 Management Studio Express</a><br />
Do not install these programs yet, just have them downloaded and ready to go.</p>
<p>I recommend also that you put the path to the BIN folder (where stsadm.exe is located) in the PATH environment variable on both servers. It is absurd having to bounce around folders and typing full paths for a lot of things. This is located here:<br />
<code>C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\xx\BIN</code><br />
(xx being the version number, 12 or 14) I&#8217;d recommend you do this under Advanced in the System properties so that it sticks. Restart your command prompt window if necessary.</p>
<p>Be sure to join the computer to the domain if you are using one, I neglected to do this during my testing, and I ran into all kinds of issues.</p>
<p><strong>Step 2: Backup Old Server</strong><br />
Next, you will need to backup your old content database. There are a number of ways to do this, but when doing the database attach method, all you need to backup is the content database. For this you will need to run Microsoft SQL Server 2005 Management Studio Express. If you do not have it you can get it <a href="http://www.microsoft.com/download/en/details.aspx?id=8961">here</a>. I am not keeping the same server name and will be renaming the site. This will help allow people to still access data while getting the new site online. If you plan on doing your move right away, you need to lock changes to the database. If you are just testing (which you are, right?), you don&#8217;t need to lock it down right away. You can lock down the database by setting it to read only. You can do that before you do the backup below. This command should set the site to Read-Only:</p>
<p><code>stsadm -o setsitelock -url http://domain/ -lock readonly</code></p>
<p>Open the Management Studio and log into the COMPUTERNAME\MICROSOFT##SSEE database. If it fails, try this instead:<br />
<code>\\.\pipe\mssql$microsoft##ssee\sql\query</code><br />
Find the database called WSS_Content, right-click, Tasks, Back Up&#8230;. In the options, choose File and add a filename. Make sure that it is a Full backup. Once you have the file, go ahead and move it to your new server. You will be needing it there shortly.</p>
<p><strong>Step 3: Install SharePoint 2010</strong><br />
You are now ready to install SharePoint Foundation 2010. Run the installer, and install the software prerequisites first. After that is installed, go ahead and start the install for SharePoint Foundation. When the install is finished, run the Configuration Wizard. You can accept most of the defaults.  In our case, we used a farm, but with a standalone server. If you are doing a farm, this guide may not help you much. When it is finished, it will open your newly created, and empty, SharePoint website.</p>
<p><strong>Step 4: Remove New Content Database</strong><br />
Login to the SharePoint 2010 Central Administrator page and go to Application Management &gt; Manage content databases. <em>[We will be using the default computer name for the web application name. If you want to do a new one (such as keep the old name), now would be a good time to do it, or you can just do an Alternate Access Mapping.]</em> Click on the database called WSS_Content and scroll to the bottom. Check the box <em>Remove content database</em> and click OK. This simply detaches the database from the Web application you have selected at the top of the page. This leaves the SharePoint site in a broken state, but no worries, we will soon be attaching a new one.</p>
<p><strong>Step 5: Import Old Database</strong><br />
You should have copied over your database earlier, you will need this now. Install the SQL 2008 Studio. Now, this may be confusing, because the installer makes no mention of it being Studio, and instead shows that it is SQL Server 2008 only. Also, in Windows 2008, you will get a Known Compatibility Issue window, just ignore it and run the program. Click on Installer on the left, and choose the first option. If the installer does not run for you (and gave an error message about a window handle), like it did not for me, here is a tip. Leave this installer window open (close the error). On your C: drive, there will be a folder that was created by the installer. Go into that folder and find the setup11.exe file and run it. This opens another installer, and it should work through there. During the install, you will see an option for the Management Studio, be sure to selected. Choose all other defaults. When it is finished, you will have the new Studio application.</p>
<p>Log into the newly created database at COMPUTERNAME\SHAREPOINT (you will probably have to type this in manually). You will see a WSS_Content_&lt;guid&gt;. You can delete this database, or rename it, or just leave it. You have two choices, new database, or overwrite. To create a new one, right-click on Databases, and choose New Database. Give your database a name, or keep WSS_Content. I used WSS_Content_3. Leave all the defaults. Once it is created, or you want to overwrite the old one, right-click the database, and go to Tasks &gt; Restore &gt; Database. Choose From device, and choose your backed up file. Select the checkbox under Restore. Under the Options page, and check Overwrite the existing database. Leave all other defaults.</p>
<p><strong>Step 6: Test Database and Copy Features/Assemblies</strong><br />
If you are using any added features or themes in SharePoint, these files will need to be copied manually. You first need to find out what is missing. Open up the SharePoint 2010 Management Shell. This is a PowerShell window with SharePoint cmdlets. Run the following:<br />
<code>Test-SPContentDatabase -Name <em>DatabaseName</em> -WebApplication http://<em>DomainName</em>/</code><br />
This will generate a list (if no list is generated, you are golden, and can skip this next tedious part). During my upgrade, I was missing a long list of features, and several setup files and assemblies. Lets start with features. On your old server, there is a folder located here:<br />
<code>C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES</code><br />
You need to copy all of these files onto the new server in the same location, but with 14 as opposed to 12. Create the folder if it does not exist. Now all of these features need to be installed and activated. I&#8217;ve posted a script below that will allow you to run through all these without typing them manually. Open up a standard command box at C:\, and paste the following on the new server after you have copied the features (and having the path setup from above, is necessary for this). You will need to change <em>domain</em> to your domain, so copy it into Notepad first:<br />
<code>cd "\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES"<br />
for /f %i in ('dir /b *.*') do stsadm -o installfeature -name %i<br />
for /f %i in ('dir /b *.*') do stsadm -o activatefeature -url http://<em>DomainName</em>/ -name %i</code><br />
This will cycle through each feature, install it, and activate it. Go back to your PS window, and run the Test-SPContentDatabase again. Your list should be shorter now. If like me, you had assemblies, you will need to copy these from the old machine also. However, you can only access these through a command prompt. You can not get to them from Windows Explorer. Copy the folders out of C:\Windows\Assembly\GAC_MSIL and get them into the same folder on the new machine. There are several ways of doing this, and I will assume you know how to copy folders via command line. Only copy the ones you need, not everything. I don&#8217;t know what will happen if you overwrite files, but I can only assume the consequences will be less than desired. When running the Test-SPContentDatabase again, you should be cleared up. If not, you&#8217;ll need to do a bit of Googling and find out what you are missing. If you&#8217;d like a list of GUIDs for features to match up names, there is a great one <a href="http://thorprojects.com/blog/archive/2007/05/16/list-of-features-with-guids.aspx">here</a>.</p>
<p><strong>Step 7: Upgrade and Mount Database</strong><br />
Now that you have installed all the requirements, you are ready to upgrade the content database to allow it to work with 2010. <del datetime="2011-11-23T15:12:16+00:00">This is very simple, and takes a single command. From the Management Shell, run the following command:<br />
<code>Upgrade-SPContentDatabase -Name <em>DatabaseName</em></code><br />
You will be asked to confirm the upgrade. There is a possibility that it does not need to be upgraded, in which case, you are fine.</del> I removed the previous, because the second time around, it didn&#8217;t work correctly. I simply mounted the database, and it did the upgrade during the mount. You are now finally ready to connect the database to the site. To do this, run this command in the management shell:<br />
<code>Mount-SPContentDatabase -AssignNewDatabaseId -Name <em>DatabaseName</em> -WebApplication http://<em>DomainName</em>/</code><br />
This will output a new ID, and attach the content database to the site. You can now look at the site, and see your pages.</p>
<p><strong>Step 8: Upgrade Views</strong><br />
Now, you may have noticed that your site looks the same, and does not have the new look to it. If you want to update the look (and I don&#8217;t know why you wouldn&#8217;t want to), run the following in the Management Shell, and it will update the main site, and all subsites.<br />
<code>$webapp = Get-SPWebApplication <del datetime="2011-11-23T15:12:16+00:00">http://<em>DomainName</em>/</del><br />
foreach ($s in $webapp.sites)<br />
{$s.VisualUpgradeWebs() }</code><br />
You now have the new look.</p>
<p><strong>Step 9: Cleanup</strong><br />
You have now successfully upgraded your Sharepoint server, however, you may still have some cleanup to do. If you have a large site, well, you may have a LOT of cleanup to do. First thing to note is that some custom features may not have copied all their data, and may not work at all. I was using a feature called Vacation Schedule, and it did not transfer. Thankfully, it was a little used feature, and I will be rebuilding it using a standard calendar with workflows. Another piece of cleanup you may need to do is modify links. Some of your links may be hardcoded for the old domain. You&#8217;ll have to hunt all of them down, and change them to the new domain. In my case, all of the permissions appeared to copy correctly for page rights, but your mileage may vary. It also appears that the Alert Me settings may have disappeared, so be sure to check that. You will also need to reapply any special customizations you may have done on the backend, and go through the Central Administration and setup things such as mail servers. You&#8217;ll need to browse around and find everything that is broken and fix them one at a time. I&#8217;ll leave that in your hands.</p>
<p><strong>Step 10: Go Live</strong><br />
If you were following these steps to create a test server and have your users test the new environment (which you should be doing before blindly walking into an upgrade!), you will need to let your users know to test it out. Be sure to let them know that any changes they make will not affect the original database, but any alerts that were setup may still go out even though they are from the new server. If this is your new production server, you can go ahead and alert your users, and make any group policy changes you will need to make to point them to the new server URL. You can also shutdown the old server now just to keep them out of it.</p>
<p>I hope this helps you. I did several days of Google searching to come across all of this information, and did not find any one good tutorial. Of course, this tutorial may be incomplete. If your Sharepoint site is extremely complex, some of the above may not be useful, and you may have a lot more to do. But if your site is that complex, you probably know a bit more than me. To be honest, before I wrote this, I really only played with the backend of Sharepoint for about a week. I didn&#8217;t have any previous experience other than building a page or two. If something above is not working, or appears to be missing, please let me know, and I will update this how-to. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2011/09/upgrade-from-sharepoint-services-3-0-to-sharepoint-foundation-2010-in-10-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory Lookup in PHP</title>
		<link>http://www.electronerdz.com/2011/08/active-directory-lookup-in-php/</link>
		<comments>http://www.electronerdz.com/2011/08/active-directory-lookup-in-php/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 20:30:31 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=12</guid>
		<description><![CDATA[I&#8217;ve found it necessary to do some searching of LDAP on a Windows server from a PHP script. It took a while to compile everything I needed, and I thought it&#8217;d be helpful if someone else had this code for &#8230; <a href="http://www.electronerdz.com/2011/08/active-directory-lookup-in-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve found it necessary to do some searching of LDAP on a Windows server from a PHP script. It took a while to compile everything I needed, and I thought it&#8217;d be helpful if someone else had this code for their use. Read on to find out how to perform an LDAP search against AD.</p>
<p><span id="more-12"></span></p>
<pre class="brush: php; title: ; notranslate">
function connectLDAP($server,$user,$password) {

// Issue the connect command
$ad_connect=ldap_connect($server) or
die (&quot;Could not connect to LDAP&quot;);

// These options are required for MS Active Directory
ldap_set_option($ad_connect, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad_connect, LDAP_OPT_REFERRALS, 0);

// Bind to AD with the username and password
$ds_connect = ldap_bind($ad_connect,$user,$password) or
die(&quot;Couldn't bind to AD!&quot;);

// Return handler
return $ad_connect;
}

function disconnectLDAP($handle) {

// Disconnect from the server
ldap_unbind($handle);

}

function searchLDAP($ad,$query,$root,$sort) {

// Query the LDAP server
// Future: Want adjust the array on the fly later, such as objectclass
$sr=ldap_search($ad, $root, $query);

// If a sort field was requested, adjust the list
if ($sort) {
$st=ldap_sort($ad, $sr, $sort);
}

// Generate the array, and return

$info = ldap_get_entries($ad, $sr);

return $info;

}

$ad = connectLDAP($AD_Server,$AD_User,$AD_Password);
$query = &quot;(&amp;amp;(objectClass=person)(SAMAccountName=*)&quot;; // Put whatever you want here
$sort = &quot;&quot;;

$info = searchLDAP($ad, $query, $AD_Root, $sort);

if ($info[&quot;count&quot;]&amp;gt;0) {
// $info is an array
}

disconnectLDAP($ad);
</pre>
<p>The above is a basic search string. What is important to note is how the array works. It is a multi-dimensional array. To access data, you will need to cycle through the fields,
<pre class="brush: php; light: true; title: ; notranslate">$info[$i][$j][0]);</pre>
<p>I hope this gets you started.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2011/08/active-directory-lookup-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your Child&#8217;s Information</title>
		<link>http://www.electronerdz.com/2011/08/your-childs-information/</link>
		<comments>http://www.electronerdz.com/2011/08/your-childs-information/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 14:05:25 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Rant]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.electronerdz.com/?p=6</guid>
		<description><![CDATA[Welcome to the tech blog. I&#8217;ll be writing in here things that I find throughout my life and career about technology. It will include things such as code that I find useful, gadgets that I&#8217;ve used, and rants about technology. &#8230; <a href="http://www.electronerdz.com/2011/08/your-childs-information/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Welcome to the tech blog. I&#8217;ll be writing in here things that I find throughout my life and career about technology. It will include things such as code that I find useful, gadgets that I&#8217;ve used, and rants about technology. I hope you enjoy it.</p>
<p>I&#8217;ll start with a rant&#8230;</p>
<p>My son is in Cub Scouts. Since we have recently moved to North Carolina, we had to find a new pack to join. We found one that appears to be a lot more involved than the pack we were in in Florida. They are even up with the times. They are using a third party website to keep track of the packs activities and events. You can post pictures, look at a calendar, find out information about the other adults, etc. Cub Scout leaders even keep all of the information about the cub scout (including the address) in the website. Here is the problem. The third party website&#8230; not so much with the times.</p>
<p>First problem I noticed when I first logged in, not using SSL. This website is hosting information about dozens of children in just our pack. Who knows how many more all over the country. And it is not using SSL to transmit this traffic about children under the age of 13? This information, including passwords is going over the clear on the Internet. If someone were to get a hold of the database, they&#8217;d have the addresses of thousands of children.</p>
<p>This is where the second problem comes in. You might say, we the database is probably encrypted. I&#8217;d like to think so. Yesterday, I signed into the site, and changed the password from the default one that was given to me in the welcome email. Well, the cub scout leader decided to resend out these welcome emails this morning, in case people did not receive them. I received this email this morning. Inside this email was the password that I had chosen yesterday. So not only is the traffic insecure, now the database is not encrypted in any fashion? You might say they could be using a reversible encryption&#8230; but I think we all know that if you hack into the site and steal the database, you&#8217;ll be able to just as easily break into the websites pages and steal the salt.</p>
<p>Anyway, I have emailed the site&#8217;s tech support team to complain about these very things and hope to get a response. In the meantime, I&#8217;ll be considering not using the site, or having incorrect information inputted for both me and my son on purpose. I&#8217;ve already changed my password to one that I don&#8217;t use on anything else.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electronerdz.com/2011/08/your-childs-information/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
