<?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></title>
	<atom:link href="http://www.jaredperry.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jaredperry.ca</link>
	<description>Entrepreneur. Programmer. Gamer.</description>
	<lastBuildDate>Wed, 05 Oct 2011 00:39:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>McAfee Agent Custom Properties</title>
		<link>http://www.jaredperry.ca/2011/10/mcafee-agent-custom-properties/</link>
		<comments>http://www.jaredperry.ca/2011/10/mcafee-agent-custom-properties/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 00:39:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=185</guid>
		<description><![CDATA[The McAfee EPO agent reports back quite a few system details out of the box, however you may run into a situation where a piece of data is not being collected that may be critical to your system management. For example you wish to obtain the service tag or hardware serial number using WMI. If [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">The McAfee EPO agent reports back quite a few system details out of the box, however you may run into a situation where a piece of data is not being collected that may be critical to your system management. For example you wish to obtain the service tag or hardware serial number using WMI. If your in a large organization that is not coherently managed or you manage a bunch of distributed locations, EPO agents maybe able help you gather this information.</p>
<p>I provide managed EPO services to multiple businesses and I also have dealt with large EPO installs. For me one big data point that I would find useful in EPO is to know the public IP of NAT&#8217;d devices, whether users are hiding behind a router on a large network or at a remote site, this information would help locate to some degree a device for sorting or investigation. One feature McAfee has provided within the agent is the ability to add custom properties (up to 4, why would you need more?) which can be set on the client and then periodically sent to the EPO server.</p>
<p>To update these custom properties you have a few options:</p>
<p>FrmInst.exe &#8211; Agent installer</p>
<p>Intiates the agent installer to reconfigure the agent, causes the agent to stop and would be noticeable by the user, however this is the recommended method by McAfee for  Windows.</p>
<blockquote><p>Example: FrmInst.exe /CustomProp<strong>s</strong>1=&#8221;Property 1&#8243;</p></blockquote>
<p>msaconfig.exe &#8211; McAfee agent configuration</p>
<p>Accomplishes the same as the agent installer without disrupting the agent and is transparent to the user, my choice the setting custom properties.</p>
<blockquote><p>Example: msaconfig -CustomProps1 &#8220;Property 1&#8243;</p></blockquote>
<p>Registry modification</p>
<p>You can also create the registry keys necessary using your script and directly add the data required.</p>
<blockquote><p>Varies based on OS/Agent version:</p>
<p>Create HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\CustomProps\</p>
<p>Add a string value with name CustomProps1 and set the value to whatever is needed</p></blockquote>
<p>Regardless of method, once the value is set and the agent communicates back to the EPO server, you should see the value your script provided,</p>
<p style="text-align: center;"><a href="http://www.jaredperry.ca/wp-content/uploads/2011/10/customprops1.png"><img class="aligncenter size-full wp-image-189" title="customprops" src="http://www.jaredperry.ca/wp-content/uploads/2011/10/customprops1.png" alt="Custom Properties" width="530" height="338" /></a></p>
<p style="text-align: left;">So, we now have the ability to use a script to update these custom property values but what next? Well if you have no easy way to deploy your script to update this value then this is all really pointless, luckily EPO has a couple easy ways to run your script remote on any system with an agent. Both ways require an executable, in my case I wrote some quick code and built it with visual studio as an executable. To get the public IP I called out to an external service such as whatismyIP or checkip.dyndns.com, converted the value they returned to a string and then used msaconfig to set one of the custom properties to this value.</p>
<p style="text-align: left;">Once you have the executable you can either register it with the EPO server and use a server task to deploy, or you can actually use agent policy to run an executable after updates occur on the client system. I prefer the later as I find this policy method easier to manage, I just reference a UNC path where the executable is located. The executable runs, updates the value and now I got the IP of the device a computer is hiding behind.</p>
<p style="text-align: left;">This is a very primitive method of finding this data however using the agent custom properties was the least painful method for the environments I deal with. Based on this example you can easily go and create other custom property values.</p>
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2011/10/mcafee-agent-custom-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPTables Simplified</title>
		<link>http://www.jaredperry.ca/2011/07/iptables-simplified/</link>
		<comments>http://www.jaredperry.ca/2011/07/iptables-simplified/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 19:03:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IT Articles]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=164</guid>
		<description><![CDATA[One common problem I come across when conducting vulnerability assessments is the lack of a host firewall or understanding on its configuration. IPTables is the standard firewall on most linux based OSes and once understood is a simple to configure and powerful packet filtering firewall. Often I see unnecessarily complex IPTables rules and the use [...]]]></description>
			<content:encoded><![CDATA[<p>One common problem I come across when conducting vulnerability assessments is the lack of a host firewall or understanding on its configuration. IPTables is the standard firewall on most linux based OSes and once understood is a simple to configure and powerful packet filtering firewall. Often I see unnecessarily complex IPTables rules and the use of automated tools without fully understanding what they are doing. So, lets walk through IPTables and develop a simple set of base rules that could be used on pretty much any server.</p>
<p><a href="http://www.netfilter.org/projects/iptables/index.html">IPTables</a> is a packet filtering firewall based on <a href="http://www.xos.nl/resources/ipfwadm/">ipfw</a> and <a href="http://people.netfilter.org/~rusty/ipchains/">IPChains</a> of the past. Pretty much every linux flavour has IPTables available, usually installed with a default ACCEPT everything and no particular ruleset. The simplest way to see what is being applied to a box is by using the command iptables -L, you should see something like this on most vanilla installs,</p>
<blockquote><p>root@tank:~# iptables -L<br />
Chain INPUT (policy ACCEPT)<br />
target     prot opt source               destination</p>
<p>Chain FORWARD (policy ACCEPT)<br />
target     prot opt source               destination</p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination</p></blockquote>
<p>If you do see some preexisting rules you can clear these out and start fresh by flushing these rules with iptables -F. (Don&#8217;t do this on production boxes or they maybe left exposed) Now we have a blank slate of IPTables default chains INPUT, FORWARD and OUTPUT all with a default policy of ACCEPT. This basically means that if a packet is processed either coming to, from or through (forwarded) the server and does not match any of our rules it will be allowed to proceed.</p>
<p>As we will be mainly dealing with filtering packets coming to the server, lets begin with the INPUT chain and a few basic rules. First of all we should put in some anti-spoofing rules so local loopback traffic can&#8217;t be spoofed by traffic coming in on external interfaces.</p>
<blockquote><p>iptables -A INPUT -i lo -j ACCEPT</p>
<p>iptables -A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT</p></blockquote>
<p>We will also need to add a rule so that IPTables accepts traffic related to or part of an already established connection, this is one of the powerful features of IPTables in that it can track connections and associated packets.</p>
<blockquote><p>iptables -A INPUT -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT</p></blockquote>
<p>Now we can get into what we want to allow and this can vary based on the purpose of the server, for a web server you will probably want to allow ping ICMP traffic, web traffic on 80 and 443 and ssh (preferably on a different port then 22).</p>
<blockquote><p>iptables -A INPUT -p icmp -m icmp &#8211;icmp-type 8 -j ACCEPT</p>
<p>iptables -A INPUT -p tcp -m state &#8211;state NEW &#8211;dport 22 -j ACCEPT</p>
<p>iptables -A INPUT -p tcp &#8211;dport 80 -j ACCEPT</p>
<p>iptables -A INPUT -p tcp &#8211;dport 443 -j ACCEPT</p></blockquote>
<p>Now lets block everything else, set a rule to reject any packet that doesn&#8217;t match our other input rules and also change the default policy of the input chain to drop as a precaution.</p>
<blockquote><p>iptables -A INPUT -j REJECT</p>
<p>iptables -P INPUT DROP</p></blockquote>
<p>The FORWARD and OUTPUT chains may need some attention too however if your not forwarding packets through your server it should be set to drop, OUTPUT on the other hand is usually unrestricted.</p>
<blockquote><p>iptables -A FORWARD -j DROP</p>
<p>iptables -P FORWARD DROP</p>
<p>iptables -A OUTPUT -j ACCEPT</p></blockquote>
<p>This is our basic ruleset, now lets run iptables -L again,</p>
<blockquote><p>root@tank:~# iptables -L<br />
Chain INPUT (policy DROP)<br />
target     prot opt source               destination<br />
ACCEPT     all  &#8211;  anywhere             anywhere<br />
REJECT     all  &#8211;  anywhere             loopback/8          reject-with icmp-port-unreachable<br />
ACCEPT     all  &#8211;  anywhere             anywhere            state RELATED,ESTABLISHED<br />
ACCEPT     icmp &#8211;  anywhere             anywhere            icmp echo-request<br />
ACCEPT     tcp  &#8211;  anywhere             anywhere            state NEW tcp dpt:ssh<br />
ACCEPT     tcp  &#8211;  anywhere             anywhere            tcp dpt:www<br />
ACCEPT     tcp  &#8211;  anywhere             anywhere            tcp dpt:https<br />
REJECT     all  &#8211;  anywhere             anywhere            reject-with icmp-port-unreachable</p>
<p>Chain FORWARD (policy DROP)<br />
target     prot opt source               destination<br />
DROP       all  &#8211;  anywhere             anywhere</p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination<br />
ACCEPT     all  &#8211;  anywhere             anywhere</p></blockquote>
<p>Now that we have our rules we will need to make sure they are loaded at startup each time, this varies between OSes however for Debian,</p>
<blockquote><p>Output the rules to a file using iptables-save &gt; /etc/iptables.rules<code></code></p>
<p>Now edit /etc/networking/interfaces to load this file when bringing up the network interface, add pre-up iptables-restore &lt; /etc/iptables.rules after iface lo inet loopback.</p></blockquote>
<p>In my next post I will talk about logging and some more complex rules to protect your servers. Also, becareful when flushing your rules with iptables -F because this will now drop all your connections with a default policy of drop for INPUT.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2011/07/iptables-simplified/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quick Malware Analysis</title>
		<link>http://www.jaredperry.ca/2011/05/quick-malware-analysis/</link>
		<comments>http://www.jaredperry.ca/2011/05/quick-malware-analysis/#comments</comments>
		<pubDate>Fri, 27 May 2011 00:15:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IT Articles]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=153</guid>
		<description><![CDATA[Not fully understanding a malware threat before eradicating it can sometimes be a grave mistake. Formatting or re-imaging a computer without fully understanding the threat will only lead back to that computer being infected again and a continued threat to other computers on your network may still be present. Even a small amount of effort [...]]]></description>
			<content:encoded><![CDATA[<p>Not fully understanding a malware threat before eradicating it can sometimes be a grave mistake. Formatting or re-imaging a computer without fully understanding the threat will only lead back to that computer being infected again and a continued threat to other computers on your network may still be present. Even a small amount of effort can dramatically help protect your organization from further infection or targeting.</p>
<p>If you use a corporate AV product, send samples to your vendor for malware that is not being detected. They will often come back with a custom update for your organization which can be pushed out to all installs on your network. Analyze firewall and system logs to see where the malware came from and what it is connecting to. This data can be fed into your firewall to block future connections and also can turn up other computers that may be infected.</p>
<p>A number of tools are now available to quickly analyze malware samples and give you the most information for little effort. Below are a few tools which I have found useful in analyzing different malware samples,</p>
<ul>
<li>Basic AV Data &#8211; <a title="Virus Total" href="http://www.virustotal.com" target="_blank">VirusTotal </a>
<ul>
<li>Super fast way to scan a file or URL against 40+ different AV engines, can help indicate if your AV vendor has detection for a file and to assist in finding further details based on what an AV detects a file as. Also provides lots of extended details and metadata that can be useful in determining the source of a file without having to setup a test environment to get this information.</li>
<li>Sample report of a EICAR test file <a title="Virus Total Sample" href="http://bit.ly/h4zl0f" target="_blank">http://bit.ly/h4zl0f</a></li>
<li>Can forward samples from email to <a href="mailto:scan@virustotal.com" target="_blank">scan@virustotal.com</a> with subject SCAN.</li>
</ul>
</li>
<li>In-depth Analysis &#8211; <a title="Xandora" href="http://www.xandora.net/xangui/" target="_blank">Xandora</a> &amp; <a title="Anubis" href="http://anubis.iseclab.org/" target="_blank">Anubis</a>
<ul>
<li>More advanced tools, Panda offers Xandora as a free service to upload binaries for analysis. It generates a lot of useful data by running the malware in a VM. Outputs file/registry changes and network connections which can be extremely valuable in blocking emerging malware threats.</li>
<li>Sample report from Xandora of Palevo <a href="http://bit.ly/h1WRdy" target="_blank">http://bit.ly/h1WRdy</a></li>
<li>Anubis is another free tool similar to Xandora, this tool not only shows network connections but provides you a pcap file.</li>
<li>Example report from Anubis <a href="http://bit.ly/g6aOsz" target="_blank">http://bit.ly/g6aOsz</a></li>
</ul>
</li>
<li>Network Data Analysis &#8211; <a href="http://www.cloudshark.org/" target="_blank">Cloudshark</a>
<ul>
<li>Now you may have some network captures collected while analyzing your samples, Cloudshark offers a quick service to view these captures without having to fire up wireshark (not a replacement but is quick.)</li>
<li>Sample report from Cloudshark, <a href="http://bit.ly/ksLsaU" target="_blank">http://bit.ly/ksLsaU</a></li>
</ul>
</li>
<li>Javascript/PDF/Flash &#8211; <a href="http://wepawet.iseclab.org/" target="_blank">Wepawet</a>
<ul>
<li>A lot of malware makes use of one of these vectors, Wepawet allows you to upload or provide a URL where all these vectors can be analyzed.</li>
<li>Really valuable in picking code out of PDFs and making sense of obfuscated Javascript code</li>
<li>Sample Report <a href="http://bit.ly/lsrn2N" target="_blank">http://bit.ly/lsrn2N</a></li>
</ul>
</li>
<li>Malware Trackers -<a href="https://zeustracker.abuse.ch/" target="_blank"> Zeus Tracker</a>, <a href="http://isc.sans.edu/tools/suspicious_domains.html" target="_blank">SANS</a>, <a href="http://www.malwaregroup.com/" target="_blank">MalwareGroup</a>, <a href="http://support.clean-mx.de/clean-mx/viruses" target="_blank">Clean MX </a>
<ul>
<li>Lots of great blacklists run by security professionals that can tell you if a computer is connecting out a known malware server, Zeus Tracker provides multiple malware lists and the creator actively works with service providers to blackhole or disconnect C&amp;C networks. SANS also provides a list with multiple levels of sensitivity combining multiple sources such as Zeus Tracker.</li>
<li>MalwareGroup and CleanMX are correlation sites that analyze servers with automation and using a number of services listed in this post to analyze a servers contents and decide its reputation. Can be really useful in determining if a site is the source of a malware infection, both offer reports on downloadable files and run them through services such as VirusTotal.</li>
</ul>
</li>
</ul>
<p>This is not an exhaustive list by any means, however these are tools I found useful and have saved me a lot of time and pain.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2011/05/quick-malware-analysis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with the Packets</title>
		<link>http://www.jaredperry.ca/2011/04/dealing-with-the-packets/</link>
		<comments>http://www.jaredperry.ca/2011/04/dealing-with-the-packets/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 01:06:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IT Articles]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=44</guid>
		<description><![CDATA[Maintaining a home or small business network can be a huge hassle these days with so many devices that interact by wireless, Ethernet and from the Internet. You may have gaming consoles, multimedia centers, laptops, servers and workstations all needing a stable network setup. Now you could easily go buy a Linksys (w/DD-WRT of course) [...]]]></description>
			<content:encoded><![CDATA[<p>Maintaining a home or small business network can be a huge hassle these days with so many devices that interact by wireless, Ethernet and from the Internet. You may have gaming consoles, multimedia centers, laptops, servers and workstations all needing a stable network setup. Now you could easily go buy a Linksys (w/<a title="DD-WRT" href="http://www.dd-wrt.com/site/index" target="_blank">DD-WRT </a>of course) or DLink router, and configure it for your needs, I would recommend this for the standard user but if you want a DIY project to add advanced features and monitoring to your network I would suggest something more. In the past I would have used a open source project called <a title="IPCop Firewall" href="http://www.ipcop.org" target="_blank">IPCop</a> (Simple IPTables packet filtering firewall), which has worked great in many deployments for small businesses I have consulted with, and as well as for my home network.</p>
<p>Recently however I had noticed the community and project had started to become slightly neglected, and as well was catering mainly to a German audience. So I went out in search of alternatives, I discovered several solutions that seemed promising including <a title="Smoothwall" href="http://www.smoothwall.org/" target="_blank">Smoothwall</a> and <a title="M0n0wall" href="http://m0n0.ch/wall/" target="_blank">M0N0wall</a>, but they were still lacking many of the features of <a title="IPCop Firewall" href="http://www.ipcop.org/" target="_blank">IPCop</a>. I then took a closer look at the <a title="IPCop Firewall" href="http://www.ipcop.org/" target="_blank">IPCop</a> community and discovered a branch off <a title="IPCop Firewall" href="http://www.ipcop.org/" target="_blank">IPCop</a> that was being updated, offering both commercial versions but as well keeping an open source version. The software was called <a title="Endian" href="http://www.endian.com/en/community/overview/" target="_blank">Endian</a> and I am now using the community version that took much of the <a title="IPCop Firewall" href="http://www.ipcop.org/" target="_blank">IPCop</a> base, updated it and included a new, slicker web interface.</p>
<p>Sample of features:</p>
<ul>
<li>Multiple Uplinks (Bonus if you have a backup ISP connection)</li>
<li>Updated and slick web interface</li>
<li>Same graphs as IPcop, showing system/network load, current connections, services, etc</li>
<li>Easy DHCP management features</li>
<li>Dynamic DNS integration</li>
<li>ClamAV scanning of downloads</li>
<li>Traffic Shaping</li>
<li>Snort Integration</li>
<li>NTop Integration</li>
<li>Port forwarding and network partitioning</li>
<li>SIP, HTTP, DNS Proxy with content filter</li>
<li>OpenVPN integration, IPSec VPN support</li>
<li>Lots of Logging options</li>
</ul>
<p>Having SNORT/NTOP integrated makes troubleshooting issues simple, analyze the traffic and easily block problem traffic. Outbound firewall configuration is super easy as well for keeping certain users from using unsupported services such as bittorrent, just allow http/s with content filtering and you got a simple net nanny type setup.</p>
<p>Checkout Endian at <a href="http://www.endian.com/en/community/overview/" target="_blank">http://www.endian.com/en/community/overview/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2011/04/dealing-with-the-packets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Workstation Inventory</title>
		<link>http://www.jaredperry.ca/2010/04/building-workstation-inventory/</link>
		<comments>http://www.jaredperry.ca/2010/04/building-workstation-inventory/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 19:37:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IT Articles]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[inventory]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=19</guid>
		<description><![CDATA[Do you currently have or need an inventory of devices on your network, including every detail about these devices? Well, if you have windows running on your workstations, then powershell could be of use. Powershell is now a built-in feature in Windows 7 and Server 2008R2, telling me it will be the standard for running [...]]]></description>
			<content:encoded><![CDATA[<p>Do you currently have or need an inventory of devices on your network, including every detail about these devices? Well, if you have windows running on your workstations, then powershell could be of use. Powershell is now a built-in feature in Windows 7 and Server 2008R2, telling me it will be the standard for running custom data mining and management scripts.</p>
<p>Powershell gives you an object oriented scripting language that allows for easy manipulation of data, for example where we are talking about getting device info, we can create a new WMI object that contains all the data about a computers BIOs very easily.</p>
<p style="padding-left: 30px;">PS C:\Documents and Settings\sysjared&gt; <em>$objBIOS = get-wmiobject -class Win32_BIOS</em><br />
PS C:\Documents and Settings\sysjared&gt; <em>$objBIOS</em></p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 95px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">SMBIOSBIOSVersion : A08</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 95px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Manufacturer      : Dell Inc.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 95px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Name              : Phoenix ROM BIOS PLUS Version 1.10 A08</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 95px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">SerialNumber      : 6XR4871</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 95px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Version           : DELL   &#8211; 7</div>
<div style="padding-left: 30px;"><em>SMBIOSBIOSVersion : A08</em></div>
<div style="padding-left: 30px;"><em>Manufacturer : Dell Inc.</em></div>
<div style="padding-left: 30px;"><em>Name : Phoenix ROM BIOS PLUS Version 1.10 A08</em></div>
<div style="padding-left: 30px;"><em>SerialNumber : 6XR3476<br />
Version : DELL   &#8211; 7</em></div>
<div style="padding-left: 30px;"><em><br />
</em></div>
<div><em><span style="font-style: normal;">So as you can see, we can get a great deal of details using powershell and the builtin WMI object cmd-lets. We now have a way to get our computer details, the next step is how can we store this data? Well in my case I decided to use the<a title="MySQL .net connector" href="http://dev.mysql.com/downloads/connector/net/" target="_blank"> MySQL .net connector</a> which I have outlined in a previous post, and have created a database to be my device inventory. Now all you have to do is put a nice face on this database, I used <a title="CakePHP" href="http://cakephp.org/" target="_blank">cakePHP</a> to quickly deploy a simple management and inventory web interface.</span></em></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2010/04/building-workstation-inventory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Listing Computer Objects with Powershell</title>
		<link>http://www.jaredperry.ca/2009/10/listing-computer-objects-with-powershell/</link>
		<comments>http://www.jaredperry.ca/2009/10/listing-computer-objects-with-powershell/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 01:17:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=42</guid>
		<description><![CDATA[Have you ever wanted to get a simple output of all the computer objects in active directory? This is a fairly simple task with Powershell, recently I wanted to output all computer objects and the attributes that associated with them for use in a tree structured menu. Below is the script that I created, (can [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to get a simple output of all the computer objects in active directory? This is a fairly simple task with Powershell, recently I wanted to output all computer objects and the attributes that associated with them for use in a tree structured menu. Below is the script that I created, (can only dump 1000 entries at a time)</p>
<blockquote>
<pre>$strFilter = "(&amp;(objectCategory=Computer))"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter
$objSearcher.SearchScope = "Subtree"
$computerObjects = $objSearcher.FindAll() | foreach {
    $name = [String]$_.Properties.cn
}
$name</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2009/10/listing-computer-objects-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sysprep Troubles in Windows 7</title>
		<link>http://www.jaredperry.ca/2009/06/sysprep-troubles-in-windows-7/</link>
		<comments>http://www.jaredperry.ca/2009/06/sysprep-troubles-in-windows-7/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 16:26:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[deployment]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[sysprep]]></category>
		<category><![CDATA[unattend]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[windows media player]]></category>
		<category><![CDATA[wmp]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=33</guid>
		<description><![CDATA[Today I began the long journey of developing a deployment image of Windows 7. Before I started installing all the standard software that my organization uses I decided to test out the new version of sysprep. So I created an &#8220;autounattend.xml&#8221; file, it automatically installed then booted a fresh install of windows 7 into sysprep [...]]]></description>
			<content:encoded><![CDATA[<p>Today I began the long journey of developing a deployment image of Windows 7. Before I started installing all the standard software that my organization uses I decided to test out the new version of sysprep. So I created an &#8220;autounattend.xml&#8221; file, it automatically installed then booted a fresh install of windows 7 into sysprep audit mode. I decided I would install Microsoft Office as a test then generalize and reseal sysprep. After clicking the button to begin sysprep I got a nice little box saying sysprep was starting. Then out of no where *beep*, and I see a warning message from sysprep that a fatal error has occurred. At this point I decided to restart in hopes it would reenter audit mode, instead it no longer would boot.</p>
<p>After googling the error, I discovered a lot of people were having this issue and I also soon found the problem, Windows Media Player. I really can&#8217;t understand why Microsoft is infesting its media playing software into a fresh install of the OS. If you remember in the past WMP in a early leak of Windows 7 caused music files to be scanned and to have a small amount of data added to the beginning of these files, corrupting them. Now they have processes from this software, running and scanning your files even from a clean install without ever opening the program. Further they missed that it would cause difficulties with sysprep, and now I have to kill these processes or disable them from services, in order to get sysprep to function correctly.</p>
<p>Source: <a href="http://social.technet.microsoft.com/Forums/en-US/w7itproinstall/thread/8f5002e1-95b4-47bf-b031-4b72b3eb388a/">http://social.technet.microsoft.com/Forums/en-US/w7itproinstall/thread/8f5002e1-95b4-47bf-b031-4b72b3eb388a/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2009/06/sysprep-troubles-in-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell and MySQL can be Friends</title>
		<link>http://www.jaredperry.ca/2009/06/powershell-and-mysql/</link>
		<comments>http://www.jaredperry.ca/2009/06/powershell-and-mysql/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 18:12:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[friends]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql.net]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=27</guid>
		<description><![CDATA[While using Powershell to collect data from a group of windows servers, I realized I would need a database to store the information collected. I was happy to learn that Powershell can utilize the MySQL.NET connector, so I could install MySQL on a server and have Powershell funnel the data with standard SQL commands into [...]]]></description>
			<content:encoded><![CDATA[<p>While using Powershell to collect data from a group of windows servers, I realized I would need a database to store the information collected. I was happy to learn that Powershell can utilize the MySQL.NET connector, so I could install MySQL on a server and have Powershell funnel the data with standard SQL commands into the database. All that I needed to do was install the .NET connector for MySQL on any machine I wished to connect to the database, in my case I installed it on all my servers. If you are worried about installing this connector, it has a small footprint and is nothing like some other database connectors like Oracles bulky ODBC driver. I have compiled a step by step list of how to configure and use MySQL within Powershell:</p>
<ol>
<li>Install MySQL.NET 5.0.9, there is newer versions, but I choose 5.0.9 because it works with all my scripts.
<ul>
<li>http://dev.mysql.com/downloads/connector/net/5.0.html</li>
</ul>
</li>
<li>If you are running a Powershell script as a task, you will need to change the execution policy in Powershell
<ul>
<li>Set-ExecutionPolicy unrestricted</li>
</ul>
</li>
<li>On servers if you want to run a Powershell script from a network share without prompt, you will need to add the share to Internet Explorers trusted sites list, apparently IE policy effects file share script execution</li>
<li>You will need to now load the connector into your powershell script, first is for 32-bit windows, the second is for 64-bit version of windows
<ul>
<li>[void][system.reflection.Assembly]::LoadFrom(&#8220;C:\Program Files\MySQL\MySQL Connector Net 5.0.9\Binaries\.NET 2.0\MySQL.Data.dll&#8221;)</li>
</ul>
<ul>
<li>[void][system.reflection.Assembly]::LoadFrom(&#8220;C:\Program Files (x86)\MySQL\MySQL Connector Net 5.0.9\Binaries\.NET 2.0\MySQL.Data.dll&#8221;)</li>
</ul>
</li>
<li>Now we will want to connect to our database
<ul>
<li>$dbconnect = New-Object MySql.Data.MySqlClient.MySqlConnection</li>
<li>$dbconnect.ConnectionString = &#8220;server=servername;user id=dbusername;password=dbpassword;database=dbname;pooling=false&#8221;</li>
<li>$dbconnect.Open()</li>
</ul>
</li>
<li>Once we have connected, we can now create a MySQL command object, below is an example SQL command
<ul>
<li>$sql = New-Object MySql.Data.MySqlClient.MySqlCommand</li>
<li>$sql.Connection = $dbconnect</li>
<li>$sql.CommandText = &#8220;INSERT INTO computer_details (computer_id, mac, dhcp, model, domain, manufacturer, type, memory, ip, servicetag, lastimagedate, servicepack, os, biosrev, scriptversion, lastrun, ou) VALUES (&#8216;$resultID&#8217;, &#8216;$macAddress&#8217;, &#8216;$dhcp&#8217;, &#8216;$model&#8217;, &#8216;$domain&#8217;, &#8216;$manufacturer&#8217;, &#8216;$systemType&#8217;, &#8216;$memory&#8217;, &#8216;$ipAddress&#8217;, &#8216;$servicetag&#8217;, NOW(), &#8216;$servicePack&#8217;, &#8216;$operatingSystem&#8217;, &#8216;$biosrev&#8217;, &#8216;$version&#8217;, NOW(), &#8216;$ou&#8217; )&#8221;</li>
<li>$sql.ExecuteNonQuery()</li>
<li>$dbconnect.Close()</li>
</ul>
</li>
</ol>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">$sq= New-Object MySql.Data.MySqlClient.MySqlCommand</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>$sql.Connection = $dbconnect</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">#Insert our computer details using the above id and all the data from the WMI objects</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>$sql.CommandText = &#8220;INSERT INTO computer_details (computer_id, mac, dhcp, model, domain, manufacturer, type, memory, ip, servicetag, lastimagedate, servicepack, os, biosrev, scriptversion, lastrun, ou) VALUES (&#8216;$resultID&#8217;, &#8216;$macAddress&#8217;, &#8216;$dhcp&#8217;, &#8216;$model&#8217;, &#8216;$domain&#8217;, &#8216;$manufacturer&#8217;, &#8216;$systemType&#8217;, &#8216;$memory&#8217;, &#8216;$ipAddress&#8217;, &#8216;$servicetag&#8217;, NOW(), &#8216;$servicePack&#8217;, &#8216;$operatingSystem&#8217;, &#8216;$biosrev&#8217;, &#8216;$version&#8217;, NOW(), &#8216;$ou&#8217; )&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>$sql.ExecuteNonQuery()</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">#Here we are making sure the database connection closes as this script has finished doing what it needs to do at this time</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 399px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>$dbconnect.Close()</div>
<p>Using this example you can now easily collect data from your servers and insert it into a database. You can as well use any SQL statement you wish, including querying a database, and using Powershell to output/manipulate this data as needed. In future posts I will get into some examples of what I have done with powershell and mysql.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2009/06/powershell-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modernizing Your File Systems</title>
		<link>http://www.jaredperry.ca/2009/06/modernizing-file-systems/</link>
		<comments>http://www.jaredperry.ca/2009/06/modernizing-file-systems/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 21:56:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[745N]]></category>
		<category><![CDATA[dfs]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[redundancy]]></category>
		<category><![CDATA[robocopy]]></category>
		<category><![CDATA[server 2008]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.jaredperry.ca/?p=3</guid>
		<description><![CDATA[In August 2008, my boss came to me with a flaw in our infrastructure that had the potential to become a larger issue, and possibly disastrous to our organization if not addressed. The problem involved our main file server, we had a setup that had all clients connected to a windows server 2003 box to [...]]]></description>
			<content:encoded><![CDATA[<p>In August 2008, my boss came to me with a flaw in our infrastructure that had the potential to become a larger issue, and possibly disastrous to our organization if not addressed. The problem involved our main file server, we had a setup that had all clients connected to a windows server 2003 box to serve roaming profiles, user home directories and workgroup folders, as well as serve network apps, software installation files, music/video files, amoung other things. With so much load on this one server the issue that appeared was the server slowing down to a crawl, as well after upgrading the machines ram we had it crash several times randomly so we reverted to the old RAM. To compound these issues we had no server that could take its place if anything went wrong, system redundancy was placed on the RAID configuration which came with the Dell 745N PowerVault server. So we began assessing the following weaknesses in our file system:</p>
<ul>
<li>Software RAID configuration</li>
<li>Single server</li>
<li>Heavy, high bandwidth load (Upwards of 200 active clients, and hundreds of thousands of active files)</li>
<li>No backup/rescue scenarios</li>
<li>Outdated OS (Running windows server 2003 storage edition, Dell customized, this became an issue as it could not be updated and was severely lacking, feature and performance wise)</li>
<li>Reliability to the clients</li>
<li>Capacity limitations (1 Terabyte total, with over 600 gigs in use)</li>
</ul>
<p>To deal with these weaknesses, the whole file server setup needed to be revamped, while the existing setup ran in parallel. It was apparent that a new server was needed, Dell no longer supplied 745N PowerVault file servers, and were instead pushing expensive SAN systems, we wanted a low cost solution that had a great deal of redundancy and performance. So we looked at our existing server, and decided we would get the same server again, but where would be find the same model? Well ebay.</p>
<p>Ebay had a large listing of Dell 745N PowerVaults, all for under $1000, the server we finally choose had the fastest P4 possible 3.2ghz, 2 GB of ram,  4 x 250GB hard drives, and a hardware raid card (PERC 5\i). This solved one major problem, taking the raid management away from the OS and putting it on a dedicated RAID controller, as well we upgraded the RAM to 4GB, and increased hard drive space to 4 x 750GB. After receiving the server, we did the hardware upgrades, then came the next problem, what do we do with the old server 2003 storage edition OS? Well its 2008, and Microsoft had updated their OS, we wanted to use server 2008. However, if you have ever worked with a Dell PowerVault they lack a CD-ROM drive, and do not support any OS besides a USB installed version of server 2003. In the months before working on the storage issue, I was working with Windows Deployment, and utilizing its PXE boot feature, we could boot into a Vista PE environment. Then I copied the contents of our server 2008 installation disc onto a large flash drive, and from a command prompt I loaded up the setup.exe from the installation files. This is a fairly easy way to install modern versions of windows, you could even make a bootable usb drive to do the installation. Once into the installation wizard, I got as far as the disk configuration, then a road block, the raid setup was not detected. It took a while but we finally found the adaptec driver from a german Dell ftp. So now we had server 2008 installed, a machine with larger capacity then before, now 2 terabytes in hardware RAID 5.</p>
<p>After running our new server for a month, doing testing with the new OS, as well as load testing, we were ready for production. Then came the painful situation of moving all the data from the old file server to the new, without disruption. Using robocopy we copied each home directory, one by one, preserving the file attributes including time stamps, then updating each user AD object to the new server. Finally we moved the workgroups, and other miscellaneous files, leaving us with a fully operational file system, that was both up to date and redundant. Looking at our initial assessment we had crossed a lot off our list:</p>
<ul>
<li><span style="text-decoration: line-through;">Software RAID configuration</span></li>
<li>Single server</li>
<li>Heavy, high bandwidth load (Upwards of 200 active clients, and hundreds of thousands of active files)</li>
<li>No backup/rescue scenarios</li>
<li><span style="text-decoration: line-through;">Outdated OS (Running windows server 2003 storage edition, Dell customized, this became an issue as it could not be updated and was severely lacking, feature and performance wise)</span></li>
<li><span style="text-decoration: line-through;">Reliability to the clients</span></li>
<li><span style="text-decoration: line-through;">Capacity limitations (1 Terabyte total, with over 600 gigs in use)</span></li>
</ul>
<p>Still, we had a few more items to accomplish, and with our offices being spread across a university, the idea of a multisite file system soon took root. To build this system, we needed to upgrade the old server, find a load balancing/file replication technology, and find an alternate location. In upgrading the old server, we added a hardware RAID card which was special ordered from Dell for a 745N, apparently they still have 5 year old RAID cards ready for order. As well we upgraded the RAM, hard drives, and fully cleaned the server to be  similar to the Ebay purchased 745N. Next we updated the OS to server 2008, using the same method, and placed it in our main IT support office building, in a storage room. At that point we had two servers with similar specs, configurations, and separate locations, so all we needed was a piece of software that works with Windows, and can handle file replication/load balancing.</p>
<p>The software we decided to go with, was something that I had worked with a year before, it was built into Windows, Distributed File System (DFS). DFS is the underlying technology that is already used to replicate data/files between domain controllers, and has been integrated into Windows server for quite sometime. In server 2003, DFS was not as feature full as I would have liked, but it did show promise, for that reason I was willing to give it another try in server 2008. After initial testing, I had concluded that DFS had made many steps forward since server 2003, it had an easier to understand setup, added namespace and replication group features. So using DFS, I configured a domain namespace for user directories, workgroups, and profiles, these namespaces mean that a client would connect to the following type of share and it would then take that user and connect them to the regionally closest file server, all transparently. Namespace links can be used the same as any share, and look like this:</p>
<ul>
<li>\\domainname\users$</li>
<li>\\domainname\profiles$</li>
<li>\\domainname\workgroupname</li>
</ul>
<p>You can also use existing share names, which will act the same as a DFS namespace, pointing to one of the servers based on region, shares like:</p>
<ul>
<li>\\server1\users$
<ul>
<li>Points to which ever server is closest, or if no sites configured it will choose randomly:
<ul>
<li>Server1</li>
<li>Server2</li>
</ul>
</li>
</ul>
</li>
<li>\\server2\users$</li>
</ul>
<p>This made for a great setup, mainly if one server went offline, it would failover to the other server, and we can easily change or add new servers without changing the share name. With the shares taken care of, the next step before they could be enabled would be to replicate files so that they are the same on both servers, even if they are being constantly edited and opened. Using the file replication section of DFS, I separated each OU&#8217;s folders into replicating folders, and once completed we had a fully replicating group of servers. Of course there was issues, which are still being weeded out but they are minor, many include how some programs place locks on certain files. So far we have alleviated any issues quickly and they have not caused disruption.</p>
<p>In conclusion, if you are a small to medium sized organization, and are running an aging file system, you should consider looking at the options I have outlined. The older Dell Powervault line may seem out of date for modern operating systems, but in the correct setup they can work perfectly to quickly serve files, and can be stacked with cheap hard drives. When looking at storage systems, always have hardware RAID, and if possible have offsite backup or even multisite replication. Server 2008, is a necessary upgrade if you choose windows for your file systems, although it is based on Vista, it lacks the issues you encounter with that desktop OS. In future posts, I will get into further detail and provide greater instruction on configuring file systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jaredperry.ca/2009/06/modernizing-file-systems/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

