<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Clint McGuire</title> <link>http://www.clintmcguire.com</link> <description>Active Directory, Exchange, Citrix, VMware - Notes, Tips, Tricks, How to's</description> <lastBuildDate>Mon, 31 Oct 2011 05:27:08 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ClintMcguire" /><feedburner:info uri="clintmcguire" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>ClintMcguire</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><title>vSphere filling up SQL Express Database</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/alGSOcXcnig/</link> <comments>http://www.clintmcguire.com/2011/09/15/vsphere-filling-up-sql-express-database/#comments</comments> <pubDate>Thu, 15 Sep 2011 16:22:46 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[ESXi 4.1]]></category> <category><![CDATA[SQL]]></category> <category><![CDATA[Virtualization]]></category> <category><![CDATA[VMware]]></category> <category><![CDATA[vSphere]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=786</guid> <description><![CDATA[<p>Have you installed vSphere with SQL Express and found that the database is nearly full?  Did you think using SQL Express 2008 R2 would be fine because it has a 10GB database size limit, but found out it wasn&#8217;t?</p><p>Well you have come to the right place.</p><p>Let me show you how you can get<p>Continue reading <a href="http://www.clintmcguire.com/2011/09/15/vsphere-filling-up-sql-express-database/">vSphere filling up SQL Express Database</a></p>]]></description> <content:encoded><![CDATA[<p>Have you installed vSphere with SQL Express and found that the database is nearly full?  Did you think using SQL Express 2008 R2 would be fine because it has a 10GB database size limit, but found out it wasn&#8217;t?</p><p>Well you have come to the right place.</p><p>Let me show you how you can get the same functionality as SQL Standard with only a bit of extra work.</p><p>Will what I am going to show you make it so you can use SQL Express with 1,000 VM Hosts and 100,000 VMs?  No.</p><p>Will what I am going to show you save buying Full SQL for a smaller environment (5-ish VM Hosts)? Probably.</p><p>Is max DB size the only reason to consider upgrading to SQL Standard?  Good question, this isn&#8217;t really a space issue to start with&#8230;  Let me explain.</p><p>The problem you are (probably) running into is an over abundance of Performance Statistics.  vSphere records these stats about every 5 minutes.  This is great, if you have a way to deal with the stats, so they don&#8217;t chew up all your disk/DB space.  And vSphere does have a way to deal with it, if you are running SQL Standard (or better).  About every 30 minutes the SQL Agent will run a stored procedure and clean up the statistics.  The trouble is SQL Express does not include the SQL Agent.</p><p>During the vSphere install/upgrade it will check what version of SQL Database engine you are running, if SQL reports it is Express the installer skips a couple things.  It won&#8217;t create the stored procedures or the SQL Agent jobs.  (You don&#8217;t have the Agent, so the jobs can&#8217;t be setup, if the jobs can be setup, why create the stored procedures?)</p><p>So we have a bit of extra work to do.</p><p>First you need to create the stored procedures.<br /> Second you need to setup scheduled tasks to run the stored procedures.</p><p>To create the stored procedures, run the stored procedure setup scripts against the vSphere database.  VMware has courteously left them lay around as part of the install.  In C:\Program Files\VMware\Infrastructure\VirtualCenter Server you should see a bunch of .sql files.  The seven you are interested in are:<br /> purge_stat1_proc_mssql.sql<br /> purge_stat2_proc_mssql.sql<br /> purge_stat3_proc_mssql.sql<br /> purge_usage_stats_proc_mssql.sql<br /> stats_rollup1_proc_mssql.sql<br /> stats_rollup2_proc_mssql.sql<br /> stats_rollup3_proc_mssql.sql.</p><p>Once the stored procedures are setup you just need to run them.  You could do this manually (<br /> <code>EXECUTE stats_rollup1_proc<br /> exec purge_stat1_proc</code>), but why would you want to?</p><p>Instead, create a .SQL script that contains this:<br /> <code>Use vSpherDBName;<br /> GO;<br /> EXECUTE stats_rollup1_proc;<br /> exec purge_stat1_proc;<br /> GO; </code></p><p>And use the Windows Task Scheduler to run a batch script containin the following command every 30 minutes:<br /> <code>SQLCMD -S DBServerName -i script.sql -h -1 </code></p><p>Note: If you have 8GB+ of stats and you are running SQL Express (limit 1 CPU and 1GB of RAM) it is going to take a long time to run the stored procedures the first time, a looong time. (Might be better to truncate the stats table and start from scratch&#8230;)</p><p>You will need to create 2 other batch script/SQL script pairs, one weekly and one monthly.<br /> The weekly SQL script will need to contain:<br /> <code>EXECUTE stats_rollup2_proc<br /> exec purge_stat2_proc<br /> exec purge_usage_stat_proc</code></p><p>The monthly script will need to contain:<br /> <code>EXECUTE stats_rollup3_proc<br /> exec purge_stat3_proc</code></p><p>Caveat emptor: I am not a DBA. Take a backup of your databases before you go monkeying with them. Turn off the VMware VirtualCenter service before you start running these (the first time).</p><p>References and other interesting things to read:<br /> <a title="VMware KB 1029824" href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1029824" target="_blank">VMware KB 1029824</a><br /> <a title="VMware KB 1003570" href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1003570" target="_blank">VMware KB 1003570</a><br /> <a title="vCenter Maintenance and Repair" href="http://techies.ncsu.edu/wiki/vCenter_Maintenance_and_Repair_Tasks" target="_blank">vCenter Maintenance and Repair</a><br /> <a title="VMware KB 1025914" href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1025914" target="_blank">VMware KB 1025914</a></p> 
<p><a href="http://feedads.g.doubleclick.net/~a/HCPNzs_e0vI-8UjCFwVs1bS_xCo/0/da"><img src="http://feedads.g.doubleclick.net/~a/HCPNzs_e0vI-8UjCFwVs1bS_xCo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/HCPNzs_e0vI-8UjCFwVs1bS_xCo/1/da"><img src="http://feedads.g.doubleclick.net/~a/HCPNzs_e0vI-8UjCFwVs1bS_xCo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/alGSOcXcnig" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/09/15/vsphere-filling-up-sql-express-database/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/09/15/vsphere-filling-up-sql-express-database/</feedburner:origLink></item> <item><title>ESXi Host Configuration Script – Deconstruction</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/jztRMAGRZ04/</link> <comments>http://www.clintmcguire.com/2011/08/15/esxi-host-configuration-script-deconstruction/#comments</comments> <pubDate>Tue, 16 Aug 2011 04:01:23 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[ESXi 4.1]]></category> <category><![CDATA[PowerCLI 4.1]]></category> <category><![CDATA[Powershell]]></category> <category><![CDATA[VMware]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=770</guid> <description><![CDATA[<p>I&#8217;ve been working on the host configuration script as I do ESXi upgrades and installs for clients. I wrote a deconstruction of an AD script that has been very popular so I thought I would write another one.</p><p>The first thing that the script does is gather information to setup the host. It will ask<p>Continue reading <a href="http://www.clintmcguire.com/2011/08/15/esxi-host-configuration-script-deconstruction/">ESXi Host Configuration Script &#8211; Deconstruction</a></p>]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been working on the <a href="http://www.clintmcguire.com/2011/05/15/esxi-4-1-u1-host-configuration-script/" title="ESXi 4.1 Host Configuration Script" target="_blank">host configuration script</a> as I do ESXi upgrades and installs for clients.  I wrote a <a href="http://www.clintmcguire.com/2011/05/29/script-deconstruction-get-all-ad-users-last-logon-time/" title="Script Deconstruction - Get all Users Last Logon" target="_blank">deconstruction of an AD script</a> that has been very popular so I thought I would write another one.</p><p>The first thing that the script does is gather information to setup the host.  It will ask for the vCenter server name, credentials to login to vSphere, the FQDN of the host you will be setting up, the host root password, IP addresses for vMotion and iSCSI and the NTP server to use for the host.</p><p>Once all the information has been entered it starts the work.</p><p>The script connects to the vSphere server and adds the host to the container that is entered.  It sets the NTP server and begins working on the vSwitches.</p><p>I don&#8217;t like having the VM Network on the same vSwitch as the Management network, so the VM Network is removed, then the new vSwitches are added.  In the script I have one Physical NIC used for each of the Private and DMZ networks and 3 Physical NICs used for iSCSI.  These can be modified to suit your environment and based on the example it should be easy to make it work for you.  If your switches are configured correctly you can also turn on Jumbo Frames for vMotion (-Mtu 9000).  I didn&#8217;t include it in the script but I recommend setting up a second management network, ideally on separate switches.</p><p>New-VirtualPortGroup doesn&#8217;t accept the -VMHost option, which causes issues when you run this script for multiple hosts.  To get around this we need to find another way to include the -VMHost in the command.  To accomplish this we create a variable for each vSwitch ($vS0 &#8211; $vS3) where we can include the host.  (Port Groups are VM Networks.)</p><p>For vMotion and iSCSI we need to setup vmks.  For multipathing we need to have multiple vmks, in this example we have 3 iSCSI nics so we need 3 vmks.</p><p>Next we need to configure the NIC teaming policy for iSCSI so that we can optimize throughput and complete the multipathing configuration.  Make sure you assign the right NICs to the vmks.  Since we are using an EqualLogic SAN in this example I followed EqualLogic&#8217;s best practices and assign one active NIC per vmk and assign all the other NICs as unused.</p><p>We then repeat the process for the Management and vMotion vmks, then modify some advanced settings.  (Advanced settings came from the EqualLogic best practices.)</p><p>The last few things the script does connected to the vSphere server are enabling iSCSI on the host, pointing it at the SAN Group IP address and setting the Mutlipathing policy for EqualLogic volumes to Round Robin.  (This is for any volumes that are configured when this command runs, if you are doing an initial setup it is unlikely to actually do anything.  This is mostly a &#8220;just in case&#8221;, but I don&#8217;t suggest removing it.)</p><p>Finally we map the vmks to individual NICs, set the default multipathing policy to Round Robin, and configure the Round Robin IOPS to 1.  This makes the host send one IO request per path, then use the next path (the default is 1000 IOs before moving onto the next).</p><p>Finally we restart the host, this is required for mapping the vmks to the NICs.</p><p>Most of these settings are applicable to other Storage vendors, from what I have read, but double check your storage vendor&#8217;s best practices.</p> 
<p><a href="http://feedads.g.doubleclick.net/~a/1NEe2FouV8v0tFXH_WJwTr2q9LY/0/da"><img src="http://feedads.g.doubleclick.net/~a/1NEe2FouV8v0tFXH_WJwTr2q9LY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/1NEe2FouV8v0tFXH_WJwTr2q9LY/1/da"><img src="http://feedads.g.doubleclick.net/~a/1NEe2FouV8v0tFXH_WJwTr2q9LY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/jztRMAGRZ04" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/08/15/esxi-host-configuration-script-deconstruction/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/08/15/esxi-host-configuration-script-deconstruction/</feedburner:origLink></item> <item><title>Brocade Certified Network Engineer</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/WyvMndnQjcM/</link> <comments>http://www.clintmcguire.com/2011/08/07/brocade-certified-network-engineer/#comments</comments> <pubDate>Sun, 07 Aug 2011 16:37:41 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[BCNE]]></category> <category><![CDATA[Brocade]]></category> <category><![CDATA[Certificate]]></category> <category><![CDATA[Certification]]></category> <category><![CDATA[Networking]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=749</guid> <description><![CDATA[<p>I passed the BCNE Exam on Thursday.</p><p>I got the shiny PDF certificate on Friday, I may print it off one day&#8230;</p><p>I have been doing more switch config over the last while, mostly related to storage, it is nice to have a current designation that reflects that.</p> ]]></description> <content:encoded><![CDATA[<p>I passed the BCNE Exam on Thursday.</p><p>I got the shiny PDF certificate on Friday, I may print it off one day&#8230;</p><p>I have been doing more switch config over the last while, mostly related to storage, it is nice to have a current designation that reflects that.</p> 
<p><a href="http://feedads.g.doubleclick.net/~a/lPW_9uPkLS6RiJ_kQuUwUTfG06w/0/da"><img src="http://feedads.g.doubleclick.net/~a/lPW_9uPkLS6RiJ_kQuUwUTfG06w/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/lPW_9uPkLS6RiJ_kQuUwUTfG06w/1/da"><img src="http://feedads.g.doubleclick.net/~a/lPW_9uPkLS6RiJ_kQuUwUTfG06w/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/WyvMndnQjcM" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/08/07/brocade-certified-network-engineer/feed/</wfw:commentRss> <slash:comments>2</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/08/07/brocade-certified-network-engineer/</feedburner:origLink></item> <item><title>Migration to EC2</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/v4hWkNswsQc/</link> <comments>http://www.clintmcguire.com/2011/08/07/migration-to-ec2/#comments</comments> <pubDate>Sun, 07 Aug 2011 16:28:16 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[Amazon Web Services]]></category> <category><![CDATA[AWS]]></category> <category><![CDATA[EC2]]></category> <category><![CDATA[Linux]]></category><guid isPermaLink="false">http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/?p=3</guid> <description><![CDATA[<p>I&#8217;ve completed the migration of my site to EC2.  It was with BlueHost.</p><p>BlueHost did a sufficient job, but I found my site to be slow, primarily on the WP-Admin side.</p><p>I set myself a decent challenge, get a Linux micro-instance configured for speed, move WordPress and make the whole thing better.</p><p>I can say<p>Continue reading <a href="http://www.clintmcguire.com/2011/08/07/migration-to-ec2/">Migration to EC2</a></p>]]></description> <content:encoded><![CDATA[<p>I&#8217;ve completed the migration of my site to EC2.  It was with BlueHost.</p><p>BlueHost did a sufficient job, but I found my site to be slow, primarily on the WP-Admin side.</p><p>I set myself a decent challenge, get a Linux micro-instance configured for speed, move WordPress and make the whole thing better.</p><p>I can say I&#8217;m quite happy with the results. The site seems a lot faster to me.<br /> <del>The one negative I have noticed is that some spaces after commas aren&#8217;t getting displayed properly. I&#8217;m not sure why, yet.  Any suggestions that might resolve the issue would be welcome.</del></p><p>Turns out there was a bug in my theme.</p> 
<p><a href="http://feedads.g.doubleclick.net/~a/yDKjt15ThNP0LA9ynELQi0Rs190/0/da"><img src="http://feedads.g.doubleclick.net/~a/yDKjt15ThNP0LA9ynELQi0Rs190/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/yDKjt15ThNP0LA9ynELQi0Rs190/1/da"><img src="http://feedads.g.doubleclick.net/~a/yDKjt15ThNP0LA9ynELQi0Rs190/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/v4hWkNswsQc" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/08/07/migration-to-ec2/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/08/07/migration-to-ec2/</feedburner:origLink></item> <item><title>Script deconstruction – Get all AD users’ last logon time</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/10bo3HtxJiQ/</link> <comments>http://www.clintmcguire.com/2011/05/29/script-deconstruction-get-all-ad-users-last-logon-time/#comments</comments> <pubDate>Mon, 30 May 2011 06:51:24 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[Active Directory]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Powershell]]></category> <category><![CDATA[Quest Cmdlets]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=666</guid> <description><![CDATA[<p>When I was writing my script to get all AD users&#8217; last logon times I was having an issue with changing the date output format. I posted my question and the version of the script I had at the time to the PowerGUI.org forums. I got an excellent suggestion from Jonathan Tyler and was able<p>Continue reading <a href="http://www.clintmcguire.com/2011/05/29/script-deconstruction-get-all-ad-users-last-logon-time/">Script deconstruction &#8211; Get all AD users&#8217; last logon time</a></p>]]></description> <content:encoded><![CDATA[<p>When I was writing my script to get all AD users&#8217; last logon times I was having an issue with changing the date output format.  I posted my question and the version of the script I had at the time to the PowerGUI.org forums.  I got an excellent suggestion from <a href="http://powergui.org/profile.jspa?userID=23738" target="_blank">Jonathan Tyler</a> and was able to correct the issue I was having.  After posting the updated version of the script a couple questions were posted asking about specifics of the script.  I thought it might be worthwhile to break the script down line by line and cover what each part does.</p><p>The primary design concern for the script is to get each users&#8217; last logon time.  Active Directory does not replicate this information, so it will be different on each DC.  We need the script to ask each DC for each users&#8217; last logon, and since we only want the most recent one we need to compare each of those values and discard all but the most recent.</p><p>The complete script can be found <a title="Get All AD Users Last Logon Time PowerShell Script" href="http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-ad-users-last-logon-time/" target="_blank">here</a>.</p><p>All the lines that begin with # are ignored by PowerShell, so we will skip them.</p><p>The first line PowerShell sees is &#8220;$DCs = Get-QADComputer -ComputerRole DomainController&#8221;.  This creates a variable called $DCs and assigns it all the Domain Controllers in the domain the script is run in.  It does this by using the Quest AD Cmdlet Get-QADComputer and telling the computer to only get the computers that are Domain Controllers.  Technically $DCs is an array, because it is a variable with multiple values.  Eg: Lets assume you are using Contoso.com and have 3 DCs, London, Toronto and Vancouver.  The value to $DCs is now &#8220;London, Toronto and Vancouver&#8221;.</p><p>Next the script creates an empty hash table called $LastLogon by having PowerShell execute &#8220;$LastLogon = @{}&#8221;<br /> A hash table is a variable that holds pairs of information.  For more info on them check out http://technet.microsoft.com/en-us/library/ee692803.aspx.</p><p>After creating our hash table we are going to have PowerShell create a For loop, &#8220;ForEach ($DC in $DCs)&#8221;.  This loop will run the script block that follows once for each $DC in $DCs.  Since we haven&#8217;t told PowerShell what a $DC is PowerShell assumes that each of the items in the $DCs array must be one $DC. In our Contoso.com example that makes $DC equal to London the first time it runs the loop, then Toronto and finally Vancouver.</p><p>The first line in our script block is &#8220;$Users = Get-QADUser -Service $DC.dnshostname -Enabled&#8221;.  Here we create a variable called $Users and assign it the values of all the enabled user accounts and all their AD properties and we are going to pull this information from each DC as we run through the For loop.  Notice how we have &#8220;.dnshostname&#8221; after $DC, what this does is give Get-QADUser the fully qualified  domain name of the DC.  If we skipped that part the script would throw an error when we ran it, because $DC actually holds every bit of information on each DC that Get-QADComputer was able to find.  Most of that information would be of no use to Get-QADUser so we need to tell it specifically what to use.  To find out what is available to us you can run &#8220;Get-QADComputer  London | Get-Member&#8221;.  This will list all the Properties and Methods that are part of the London object.  In this case we are looking for &#8220;dnshostname&#8221;.</p><p>Now that we have all the information from the domain controller we need to evaluate it and start building our list of the last logon times.  To do that we need PowerShell to look at each user we put into $Users so we run another For loop, &#8220;ForEach ($User in $Users)&#8221;.</p><p>So here we are ready to get the last logon for the user.  All it requires is $User.LastLogon (a property of the user we got from Get-QADUser), but to simplify comparison I want it in UTC format (YYYY-MM-DD HH:MM:SS).  UTC isn&#8217;t the default for PowerShell (unfortunately) so we will need to pass the last logon to Get-Date and have it change the format.  However, some users may not have logged in, or may not have logged in using all DCs, so it is entirely likely that some users&#8217; last logon times will be NULL.  This posses a problem for Get-Date since NULL can&#8217;t be a date, so we need to check that the last logon is something other than NULL before we hand it off to Get-Date.  So we use If and Else.  The If statement &#8220;If ($User.LastLogon -ne $null)&#8221; checks to see that LastLogon is not equal to NULL.  If this is true then we have PowerShell run &#8220;$Time = $User.LastLogon | Get-Date -Format u&#8221;.  Which assigns $Time the last logon information after converting it to UTC.  However, if LastLogon is NULL then we have PowerShell run &#8220;$Time = $User.LastLogon&#8221;, which effectively sets $Time to $null&#8230;</p><p>Now that we have our last logon time we need to isolate the name we want to use for the user.  I have chosen the AD Display name, but I could have used SAM account name (more properties of the user, courtesy Get-Member).  This looks like &#8220;$UserName = $User.DisplayName&#8221;.</p><p>It is now time to start using our hash table $LastLogon that we setup as empty at the start.  Because we are going to run this script for each user against each DC we need to check to see if the user exists in the hash table, &#8220;if ($LastLogon.ContainsKey($UserName))&#8221;.  When this part of the script runs for the first time (against London in our example) it will be false, the hash table is empty, so it will jump down to the Else part and start building our data, &#8220;$LastLogon.Add($UserName, $Time)&#8221;.  However, once the script runs against the other DCs (Toronto and Vancouver), our If statement will be true.</p><p>This is where we have PowerShell evaluate the last logon times.  This evaluation calls for another If statement, &#8220;if ($LastLogon.Get_Item($UserName) -le $Time)&#8221;.  If you checked out the page about hash tables then you know that the Get_Item ($UserName) will return the $Time in the table for $Username.  So this makes PowerShell look at the $Time in the table and compare it to the $Time we got from the current DC we are running against, if the one in the table is less than or equal to (-le) it runs the second to last bit of our script, &#8220;$LastLogon.Set_Item($UserName, $Time)&#8221;.  This is where our hash table gets updated to the most recent $Time.</p><p>The final part of the script runs only once, it organizes the data in our table and exports it to a CSV file, &#8220;$LastLogon.GetEnumerator() | Sort-Object Name |export-csv $homeAllADUserLastLogon.csv&#8221;</p><p>Please let me know if you have any questions or need further clarification on any sections.</p> 
<p><a href="http://feedads.g.doubleclick.net/~a/4iEz3VNWeApkuM0_E9mcBgU_zZs/0/da"><img src="http://feedads.g.doubleclick.net/~a/4iEz3VNWeApkuM0_E9mcBgU_zZs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/4iEz3VNWeApkuM0_E9mcBgU_zZs/1/da"><img src="http://feedads.g.doubleclick.net/~a/4iEz3VNWeApkuM0_E9mcBgU_zZs/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/10bo3HtxJiQ" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/05/29/script-deconstruction-get-all-ad-users-last-logon-time/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/05/29/script-deconstruction-get-all-ad-users-last-logon-time/</feedburner:origLink></item> <item><title>Powershell script to get all computers last logon time</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/aisPudhAIvc/</link> <comments>http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-computers-last-logon-time/#comments</comments> <pubDate>Mon, 30 May 2011 05:20:34 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[Active Directory]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Powershell]]></category> <category><![CDATA[Quest Cmdlets]]></category> <category><![CDATA[Scripting]]></category> <category><![CDATA[Windows Server 2008 R2]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=662</guid> <description><![CDATA[<p>I wrote a script to get the last time each computer logged into the domain. ##============================================================================== ##============================================================================== ## SCRIPT.........: Get-AllComputerLastLogon ## AUTHOR.........: Clint McGuire ## EMAIL..........: ## VERSION........: 1 ## DATE...........: 2011_05_26 ## COPYRIGHT......: 2011, Clint McGuire ## LICENSE........: ## REQUIREMENTS...: Powershell v2.0, Quest AD Cmdlets ## DESCRIPTION....: Gets all computer accounts' last logon times<p>Continue reading <a href="http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-computers-last-logon-time/">Powershell script to get all computers last logon time</a></p>]]></description> <content:encoded><![CDATA[<p>I wrote a script to get the last time each computer logged into the domain.<br /> <br /> <code span style="color: #0000ff;"><br /> ##==============================================================================<br /> ##==============================================================================<br /> ##  SCRIPT.........:  Get-AllComputerLastLogon<br /> ##  AUTHOR.........:  Clint McGuire<br /> ##  EMAIL..........:<br /> ##  VERSION........:  1<br /> ##  DATE...........:  2011_05_26<br /> ##  COPYRIGHT......:  2011, Clint McGuire<br /> ##  LICENSE........:<br /> ##  REQUIREMENTS...:  Powershell v2.0, Quest AD Cmdlets<br /> ##  DESCRIPTION....:  Gets all computer accounts' last logon times and exports to CSV file.<br /> ##  NOTES..........:<br /> ##  CUSTOMIZE......:<br /> ##==============================================================================<br /> ##  REVISED BY.....:<br /> ##  EMAIL..........:<br /> ##  REVISION DATE..:<br /> ##  REVISION NOTES.:<br /> ##<br /> ##==============================================================================<br /> ##==============================================================================<br /> ##==============================================================================<br /> ##  START &lt;code&gt;<br /> ##==============================================================================<br /> $DCs = Get-QADComputer -ComputerRole DomainController<br /> $LastLogon = @{}<br /> ForEach ($DC in $DCs) {<br /> $Computers = Get-QADcomputer -Service $dc.dnshostname -ip lastlogontimestamp<br /> ForEach ($Computer in $Computers)<br /> {<br /> If ($Computer.lastlogontimestamp -ne $null)<br /> {<br /> $Time = $Computer.lastlogontimestamp | Get-Date -format u<br /> }<br /> Else<br /> {<br /> $Time = $Computer.lastlogontimestamp<br /> }<br /> $ComputerName = $Computer.ComputerName<br /> If ($LastLogon.ContainsKey($ComputerName))<br /> {<br /> If ($LastLogon.Get_Item($ComputerName) -le $Time)<br /> {<br /> $LastLogon.Set_Item($ComputerName, $Time)<br /> }<br /> }<br /> Else<br /> {<br /> $LastLogon.Add($ComputerName, $Time)<br /> }<br /> }<br /> }<br /> $LastLogon.GetEnumerator() | Sort-Object Name |export-csv $home\ComputerLastLogon.csv<br /> ##==============================================================================<br /> ##  END &lt;code&gt;<br /> ##==============================================================================</code></p> 
<p><a href="http://feedads.g.doubleclick.net/~a/bdHFMx07JeLY869bbJa--sJTO2U/0/da"><img src="http://feedads.g.doubleclick.net/~a/bdHFMx07JeLY869bbJa--sJTO2U/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/bdHFMx07JeLY869bbJa--sJTO2U/1/da"><img src="http://feedads.g.doubleclick.net/~a/bdHFMx07JeLY869bbJa--sJTO2U/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/aisPudhAIvc" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-computers-last-logon-time/feed/</wfw:commentRss> <slash:comments>4</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-computers-last-logon-time/</feedburner:origLink></item> <item><title>Powershell script to get all AD users’ last logon time</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/yMsDstedP38/</link> <comments>http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-ad-users-last-logon-time/#comments</comments> <pubDate>Mon, 30 May 2011 05:12:52 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[Active Directory]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Powershell]]></category> <category><![CDATA[Quest Cmdlets]]></category> <category><![CDATA[Scripting]]></category> <category><![CDATA[Windows Server 2008 R2]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=644</guid> <description><![CDATA[<p>I wanted to see when all users in a client&#8217;s domain last logged in.</p><p>Here is the script I wrote. ##============================================================================== ##============================================================================== ## SCRIPT.........: Get-AllUserLastLogon ## AUTHOR.........: Clint McGuire ## EMAIL..........: ## VERSION........: 1 ## DATE...........: 2011_05_26 ## COPYRIGHT......: 2011, Clint McGuire ## LICENSE........: ## REQUIREMENTS...: Powershell v2.0, Quest AD Cmdlets ## DESCRIPTION....: Gets all<p>Continue reading <a href="http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-ad-users-last-logon-time/">Powershell script to get all AD users&#8217; last logon time</a></p>]]></description> <content:encoded><![CDATA[<p>I wanted to see when all users in a client&#8217;s domain last logged in.</p><p>Here is the script I wrote.<br /> <span style="color: #0000ff;"><code><br /> ##==============================================================================<br /> ##==============================================================================<br /> ##  SCRIPT.........:  Get-AllUserLastLogon<br /> ##  AUTHOR.........:  Clint McGuire<br /> ##  EMAIL..........:<br /> ##  VERSION........:  1<br /> ##  DATE...........:  2011_05_26<br /> ##  COPYRIGHT......:  2011, Clint McGuire<br /> ##  LICENSE........:<br /> ##  REQUIREMENTS...:  Powershell v2.0, Quest AD Cmdlets<br /> ##  DESCRIPTION....:  Gets all enabled users last logon times and exports to CSV file.<br /> ##  NOTES..........:<br /> ##  CUSTOMIZE......:<br /> ##==============================================================================<br /> ##  REVISED BY.....:<br /> ##  EMAIL..........:<br /> ##  REVISION DATE..:<br /> ##  REVISION NOTES.:<br /> ##<br /> ##==============================================================================<br /> ##==============================================================================<br /> <span style="color: #0000ff;"><br /> ##==============================================================================<br /> ##  START<br /> ##==============================================================================<br /> $DCs = Get-QADComputer -ComputerRole DomainController<br /> $LastLogon = @{}<br /> ForEach ($DC in $DCs) {<br /> $Users = Get-QADUser -Service $dc.dnshostname -Enabled<br /> ForEach ($User in $Users)<br /> {<br /> If ($User.LastLogon -ne $null)<br /> {<br /> $Time = $User.LastLogon | Get-Date -Format u<br /> }<br /> Else<br /> {<br /> $Time = $User.LastLogon<br /> }<br /> $UserName = $User.DisplayName<br /> If ($LastLogon.ContainsKey($UserName))<br /> {<br /> If ($LastLogon.Get_Item($UserName) -le $Time)<br /> {<br /> $LastLogon.Set_Item($UserName, $Time)<br /> }<br /> }<br /> Else<br /> {<br /> $LastLogon.Add($UserName, $Time)<br /> }<br /> }<br /> }<br /> $LastLogon.GetEnumerator() | Sort-Object Name |Export-csv $homeAllADUserLastLogon.csv<br /> ##==============================================================================<br /> ##  End<br /> ##==============================================================================<br /> </code></p><p>Check out the deconstruction of my script <a title="Script deconstruction – Get all AD users’ last logon time" href="http://www.clintmcguire.com/2011/05/29/script-deconstruction-get-all-ad-users-last-logon-time/">here</a>.</p> 
<p><a href="http://feedads.g.doubleclick.net/~a/e05i2MbiYCqFXzyNGSG1e2W-Xe4/0/da"><img src="http://feedads.g.doubleclick.net/~a/e05i2MbiYCqFXzyNGSG1e2W-Xe4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/e05i2MbiYCqFXzyNGSG1e2W-Xe4/1/da"><img src="http://feedads.g.doubleclick.net/~a/e05i2MbiYCqFXzyNGSG1e2W-Xe4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/yMsDstedP38" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-ad-users-last-logon-time/feed/</wfw:commentRss> <slash:comments>12</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/05/29/powershell-script-to-get-all-ad-users-last-logon-time/</feedburner:origLink></item> <item><title>ESXi 4.1 U1 Host Configuration Script</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/7cso6nKTwvk/</link> <comments>http://www.clintmcguire.com/2011/05/15/esxi-4-1-u1-host-configuration-script/#comments</comments> <pubDate>Sun, 15 May 2011 21:56:01 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[ESXi 4.1]]></category> <category><![CDATA[PowerCLI 4.1]]></category> <category><![CDATA[Powershell]]></category> <category><![CDATA[Scripting]]></category> <category><![CDATA[VMware]]></category> <category><![CDATA[vSphere]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=634</guid> <description><![CDATA[<p>Update: 2011-08-14 &#8211; I&#8217;ve corrected some issues that crop up when this script is run on the second and subsequent hosts.</p><p>It was time to upgrade to ESXi 4.1 U1 and I didn&#8217;t want to run through configuring all the VM Hosts manually.</p><p>This script will need to be customized for your environment.</p><p>It prompts<p>Continue reading <a href="http://www.clintmcguire.com/2011/05/15/esxi-4-1-u1-host-configuration-script/">ESXi 4.1 U1 Host Configuration Script</a></p>]]></description> <content:encoded><![CDATA[<p>Update: 2011-08-14 &#8211; I&#8217;ve corrected some issues that crop up when this script is run on the second and subsequent hosts.</p><p>It was time to upgrade to ESXi 4.1 U1 and I didn&#8217;t want to run through configuring all the VM Hosts manually.</p><p>This script will need to be customized for your environment.</p><p>It prompts you to reboot the VM Host at the end, it is required for the multipath setup, please don&#8217;t run this script on a machine in production.</p><p>The script will configure one host at a time and add it to your vCenter.  It is configured to setup 3 additional networks (Private, DMZ, iSCSI) and will remove the default VM Network from vSwitch 0.</p><p>There is a long list of sources for assistance on this, I will list as many as I can recall/find at the bottom.</p><p>Let me know in the comments if you find this useful or typos, etc.</p><p><code span style="color: #0000ff;">##==============================================================================<br /> ##==============================================================================<br /> ##  SCRIPT.........:  VMwareHostConfiguration<br /> ##  AUTHOR.........:  Clint McGuire<br /> ##  EMAIL..........:<br /> ##  VERSION........:  2<br /> ##  DATE...........:  2011_05_11<br /> ##  COPYRIGHT......:  2011, Clint McGuire<br /> ##  LICENSE........:<br /> ##  REQUIREMENTS...:  Powershell v2.0, PowerCLI 4.1.1, vCenter configured and running<br /> ##					  one HA Cluster configured.<br /> ##  DESCRIPTION....:  PowerCLI Host Configuration Script<br /> ##<br /> ##  NOTES..........:  Customizations required: vmNics assignment, number and names<br /> ##					  for vSwitches.<br /> ## 					  Assumes you are only using EqualLogic for SAN.<br /> ##  CUSTOMIZE......:<br /> ##==============================================================================<br /> ##  REVISED BY.....:Clint McGuire<br /> ##  EMAIL..........:<br /> ##  REVISION DATE..:2011-08-05<br /> ##  REVISION NOTES.:Corrected issues with vSwitch creation on second and subsequent hosts.<br /> ##<br /> ##==============================================================================<br /> ##==============================================================================<br /> <span style="color: #0000ff;"><br /> ##==============================================================================<br /> ##  START<br /> ##==============================================================================<br /> ##--------------------------------------------------------------------------<br /> ##  Gather info for script<br /> ##--------------------------------------------------------------------------<br /> <span style="color: #0000ff;"><br /> $vSphere=Read-Host "Enter the name of the vSphere server."<br /> $vCenterUser = read-host "Enter Username for vCenter"<br /> $vCenterPass = read-host "Enter Password for vCenter" -assecurestring:$true<br /> $VMHost=(Read-Host "Enter the name of the ESXi Host[FQDN]").ToLower()<br /> $HostRootPass=Read-Host "Enter the password for root on the host" -assecurestring:$true<br /> $VMotionIP=Read-Host "Enter the VMotion IP address for this ESXi Host (x.x.x.x)"<br /> $VMotionSubnet=Read-Host "Enter the VMotion network subnet mask (e.g., 255.255.255.0)"<br /> $iSCSI1IP=Read-Host "Enter the IP Address for the first iSCSI Adapter"<br /> $iSCSI2IP=Read-Host "Enter the IP Address for the second iSCSI Adapter"<br /> $iSCSI3IP=Read-Host "Enter the IP Address for the third iSCSI Adapter"<br /> #$iSCSI4IP=Read-Host "Enter the IP Address for the forth iSCSI Adapter"<br /> $iSCSISubnet=Read-Host "Enter the iSCSI Subnet Mask"<br /> $iSCSITarget=Read-Host "Enter the Group IP address for the EqualLogic"<br /> $vSphereContainer=Read-Host "Enter the name of the Cluster to add the host to"<br /> $HostRootUser='root'<br /> $HostCred = New-Object System.Management.Automation.PSCredential -ArgumentList $HostRootUser,$HostRootPass<br /> $NTPServer=Read-Host "Enter the IP of the NTP Server"<br /> $vCenterCred = New-Object System.Management.Automation.PSCredential -ArgumentList $vCenterUser,$vCenterPass</p><p><span style="color: #0000ff;"></p><p><span style="color: #0000ff;">##--------------------------------------------------------------------------<br /> ## Run script against vCenter<br /> ##--------------------------------------------------------------------------<br /> #Clears any open connections<br /> Disconnect-VIServer *<br /> #Connect to vCenter<br /> Connect-VIServer $vSphere -Credential $vCenterCred</p><p><span style="color: #0000ff;">#Add host to Cluster<br /> Add-VMHost $VMHost -Force -Location $vSphereContainer -Credential $HostCred</p><p>#Add NTP<br /> Add-VMHostNtpServer -VMHost $VMHost -NtpServer $NTPServer</p><p>#Remove VM Network from vSwitch0<br /> Get-VirtualPortGroup -Name "VM Network" | Remove-VirtualPortGroup</p><p>#Setup vSwitches and Create vSwitch variables ($vS#)<br /> #Private<br /> New-VirtualSwitch -VMHost $VMHost -name "vSwitch1" -Nic "vmnic1"<br /> #DMZ<br /> New-VirtualSwitch -VMHost $VMHost -Name "vSwitch2" -Nic "vmnic2"<br /> #iSCSI<br /> New-VirtualSwitch -VMHost $VMHost -Name "vSwitch3" -Nic "vmnic3","vmnic5","vmnic7" -Mtu 9000<br /> #vMotion<br /> $vS0 = Get-VirtualSwitch -VMHost $VMHost -Name "vSwitch0"<br /> Set-VirtualSwitch -VirtualSwitch $vS0 -Nic "vmnic0","vmnic4"<br /> $vS1 = Get-VirtualSwitch -VMHost $VMHost -Name "vSwitch1"<br /> $vS2 = Get-VirtualSwitch -VMHost $VMHost -Name "vSwitch2"<br /> $vS3 = Get-VirtualSwitch -VMHost $VMHost -Name "vSwitch3"</p><p>#Setup PortGroups<br /> New-VirtualPortGroup -Name Private -VirtualSwitch $vS1<br /> New-VirtualPortGroup -Name DMZ -VirtualSwitch $vS2<br /> New-VirtualPortGroup -Name iSCSI -VirtualSwitch $vS3</p><p>#Setup VMKernel/vMotion<br /> New-VMHostNetworkAdapter -vmhost $VMHost -PortGroup "vMotion" -VirtualSwitch "vS0" -IP $VMotionIP -SubnetMask $VMotionSubnet -VMotionEnabled:$true<br /> New-VMHostNetworkAdapter -vmhost $VMHost -PortGroup "iSCSI1" -VirtualSwitch "vS3" -IP $iSCSI1IP -SubnetMask $iSCSISubnet -Mtu 9000<br /> New-VMHostNetworkAdapter -vmhost $VMHost -PortGroup "iSCSI2" -VirtualSwitch "vS3" -IP $iSCSI2IP -SubnetMask $iSCSISubnet -Mtu 9000<br /> New-VMHostNetworkAdapter -vmhost $VMHost -PortGroup "iSCSI3" -VirtualSwitch "vS3" -IP $iSCSI3IP -SubnetMask $iSCSISubnet -Mtu 9000<br /> #New-VMHostNetworkAdapter -vmhost $VMHost -PortGroup "iSCSI4" -VirtualSwitch "vSwitch3" -IP $iSCSIIP -SubnetMask $iSCSISubnet -Mtu 9000</p><p>#Configure iSCSI Port NIC Teaming<br /> Get-VirtualPortGroup -VMHost $VMHost -Name iSCSI1 | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicActive "vmnic4" -MakeNicUnused "vmnic5","vmnic7"<br /> Get-VirtualPortGroup -VMHost $VMHost -Name iSCSI2 | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicActive "vmnic5" -MakeNicUnused "vmnic4","vmnic7"<br /> Get-VirtualPortGroup -VMHost $VMHost -Name iSCSI3 | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicActive "vmnic7" -MakeNicUnused "vmnic4","vmnic5"<br /> #Get-VirtualPortGroup -Name iSCSI4 | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicUnused "vmnic5","vmnic7"</p><p>#Configure vSwitch0 Port Teaming<br /> Get-VirtualPortGroup -VMHost $VMHost -Name 'Management Network' | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicStandby "vmnic4"<br /> Get-VirtualPortGroup -VMHost $VMHost -Name vMotion | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicActive "vmnic4" -MakeNicStandby "vmnic0"</p><p>#Advanced Config<br /> Set-VMHostAdvancedConfiguration -VMHost $VMHost -Name "Disk.UseDeviceReset" -Value 0<br /> Set-VMHostAdvancedConfiguration -VMHost $VMHost -Name "Disk.UseLunReset" -Value 1</p><p>#Enabled iSCSI &#038; Configure SAN<br /> Get-VMHostStorage -VMHost $VMHost | Set-VMHostStorage -SoftwareIScsiEnabled $True<br /> Start-Sleep -Seconds 30<br /> $iSCSIHBA = Get-VMHostHba -VMHost $VMHost -Type iSCSI<br /> New-IScsiHbaTarget -IScsiHba $iSCSIHBA -Address $iSCSITarget -Port "3260"</p><p>#Set iSCI Multipathing Profile for all connected EqualLogic Vols<br /> Get-VMHost $VMHost | Get-ScsiLun -CanonicalName “naa.6090*” | Set-ScsiLun -MultipathPolicy “roundrobin”</p><p>Disconnect-VIServer *</p><p>##--------------------------------------------------------------------------<br /> ## Run script against VMHost<br /> ##--------------------------------------------------------------------------</p><p>#Map vmk#s to iSCSI Software Initiator VMHBA (must be done connected to esxi node)</p><p>Connect-VIServer -Server $VMHost -Credential $HostCred</p><p>$esxcli = Get-EsxCli –Server $VMHost<br /> $iSCSIHBA = Get-VMHostHba -Type iSCSI #|where  {$_.Model -like "iSCSI*"}<br /> $vmks = Get-VMHostNetworkAdapter | where {$_.PortGroupName -like "iSCSI*"}<br /> foreach ($vmk in $vmks) {<br /> $esxcli.swiscsi.nic.add("$iSCSIHBA", "$vmk")<br /> }<br /> #Set default Multipath Policy to Round Robin<br /> $esxcli.nmp.satp.setdefaultpsp("VMW_PSP_RR","VMW_SATP_EQL")</p><p>#Set Round Robin IOPS to 1<br /> $esxcli.nmp.device.list() | Where {$_.PathSelectionPolicy -eq "VMW_PSP_RR"} |<br /> foreach{$esxcli.nmp.roundrobin.setconfig($null, $_.device, 1, ”iops”,$null)}</p><p>Restart-VMHost $VMHost -Force -Confirm:$true<br /> ##==============================================================================<br /> ##  END<br /> ##==============================================================================</code></p><p>sources of assistance (in no particular order):</p><p>http://communities.vmware.com/thread/296441</p><p>http://runningvm.wordpress.com/2010/08/31/vsphere-powercli-multipath-policy-script-examples/</p><p>http://communities.vmware.com/thread/312992</p><p>http://www.motogobi.com/2010/12/17/setting-multipath-policy-via-powercli/</p><p>http://communities.vmware.com/message/1491825?tstart=0</p><p>http://www.van-lieshout.com/2011/01/esxcli-powercli/</p> 
<p><a href="http://feedads.g.doubleclick.net/~a/JzaZfXM2WuF5riyjoPFys9UxnWM/0/da"><img src="http://feedads.g.doubleclick.net/~a/JzaZfXM2WuF5riyjoPFys9UxnWM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/JzaZfXM2WuF5riyjoPFys9UxnWM/1/da"><img src="http://feedads.g.doubleclick.net/~a/JzaZfXM2WuF5riyjoPFys9UxnWM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/7cso6nKTwvk" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/05/15/esxi-4-1-u1-host-configuration-script/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/05/15/esxi-4-1-u1-host-configuration-script/</feedburner:origLink></item> <item><title>How to setup Citrix Access Gateway 5.0 with Active Directory</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/GouU_XA3wTw/</link> <comments>http://www.clintmcguire.com/2011/05/07/how-to-setup-citrix-access-gateway-5-0-with-active-directory/#comments</comments> <pubDate>Sat, 07 May 2011 07:37:03 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[Citrix]]></category> <category><![CDATA[Citrix Access Gateway 5.0]]></category> <category><![CDATA[Windows Server 2008 R2]]></category> <category><![CDATA[XenApp]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=550</guid> <description><![CDATA[<p>I recently setup a new Citrix environment for a client. I wasn&#8217;t able to find a good setup guide for the Citrix Access Gateway, so I thought I would write one.</p><p>The initial setup of the CAG is straightforward. Citrix has a video for the VPX setup, the physical appliance setup is similar.</p><p>Once the<p>Continue reading <a href="http://www.clintmcguire.com/2011/05/07/how-to-setup-citrix-access-gateway-5-0-with-active-directory/">How to setup Citrix Access Gateway 5.0 with Active Directory</a></p>]]></description> <content:encoded><![CDATA[<p>I recently setup a new Citrix environment for a client.  I wasn&#8217;t able to find a good setup guide for the Citrix Access Gateway, so I thought I would write one.</p><p>The initial setup of the CAG is straightforward.  Citrix has a <a title="CAG Setup" href="http://www.citrix.com/tv/#videos/2696" target="_blank">video</a> for the VPX setup, the physical appliance setup is similar.</p><p>Once the appliance is accessible through the webpage finish the Networking Setup.</p><p><a href="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/Network.png"><img class="alignleft size-medium wp-image-581" title="Network" src="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/Network-300x166.png" alt="" width="300" height="166" /></a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Add the DNS information for you environment.</p><p><a href="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/DNS.png"><img class="alignleft size-medium wp-image-579" title="DNS" src="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/DNS-300x160.png" alt="" width="300" height="160" /></a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Setup NTP.</p><p><a href="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/NTP.png"><img class="alignleft size-medium wp-image-582" title="NTP" src="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/NTP-300x236.png" alt="" width="300" height="236" /></a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Install a license, we are using basic logon points in this environment so I am only using the platform license.</p><p><a href="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/Licensing.png"><img class="alignleft size-medium wp-image-580" title="Licensing" src="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/Licensing-300x143.png" alt="" width="300" height="143" /></a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Once the license is setup configure your XenApp/XenDesktop server range, we only have one XenApp server setup for the initial testing.</p><p><a href="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/XenApp-Servers.png"><img class="alignleft size-medium wp-image-589" title="XenApp Servers" src="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/XenApp-Servers-300x231.png" alt="" width="300" height="231" /></a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Add the STA details.</p><p><a href="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/STA-Servers.png"><img class="alignleft size-medium wp-image-583" title="STA Servers" src="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/STA-Servers-300x249.png" alt="" width="300" height="249" /></a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Add the Authentication information.</p><p><a href="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/AD-Authentication.png"><img class="alignleft size-medium wp-image-577" title="AD Authentication" src="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/AD-Authentication-300x194.png" alt="" width="300" height="194" /></a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Create the login point.</p><p><a href="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/Default-Logon-Point.png"><img class="alignleft size-medium wp-image-578" title="Default Logon Point" src="http://ec2-50-18-94-188.us-west-1.compute.amazonaws.com/wp-content/uploads/2011/03/Default-Logon-Point-300x189.png" alt="" width="300" height="189" /></a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Create a web interface site to work with the gateway.  (Which I may cover separately.)</p><p>&nbsp;</p><p>&nbsp;</p> 
<p><a href="http://feedads.g.doubleclick.net/~a/8VzrfEMQYOb-tzm9bxg1hQL-Gd4/0/da"><img src="http://feedads.g.doubleclick.net/~a/8VzrfEMQYOb-tzm9bxg1hQL-Gd4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8VzrfEMQYOb-tzm9bxg1hQL-Gd4/1/da"><img src="http://feedads.g.doubleclick.net/~a/8VzrfEMQYOb-tzm9bxg1hQL-Gd4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/GouU_XA3wTw" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/05/07/how-to-setup-citrix-access-gateway-5-0-with-active-directory/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/05/07/how-to-setup-citrix-access-gateway-5-0-with-active-directory/</feedburner:origLink></item> <item><title>Restart BES 4.1.X services with PowerShell</title><link>http://feedproxy.google.com/~r/ClintMcguire/~3/c4JE64DK0vM/</link> <comments>http://www.clintmcguire.com/2011/04/15/restart-bes-4-1-x-services-with-powershell/#comments</comments> <pubDate>Fri, 15 Apr 2011 17:23:11 +0000</pubDate> <dc:creator>clint</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[BES]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Powershell]]></category> <category><![CDATA[Scripting]]></category><guid isPermaLink="false">http://www.clintmcguire.com/?p=596</guid> <description><![CDATA[<p>One of my clients was having issues w/ BES after the Exchange server was rebooted. Aaron at work wrote a couple batch files to stop and start the services in the correct order. I&#8217;ve re-written the scripts in PowerShell below. I was hoping to use &#8220;Get-Service BES*&#8221; and piping it to Stop-Service and Start-Service, but<p>Continue reading <a href="http://www.clintmcguire.com/2011/04/15/restart-bes-4-1-x-services-with-powershell/">Restart BES 4.1.X services with PowerShell</a></p>]]></description> <content:encoded><![CDATA[<p>One of my clients was having issues w/ BES after the Exchange server was rebooted.  Aaron at work wrote a couple batch files to stop and start the services in the correct order.  I&#8217;ve re-written the scripts in PowerShell below.<br /> I was hoping to use &#8220;Get-Service BES*&#8221; and piping it to Stop-Service and Start-Service, but then the services wouldn&#8217;t be restarted in the correct order.</p><p><span style="color: #0000ff;"><code>##==============================================================================<br /> ##==============================================================================<br /> ##  SCRIPT.........:  RestartBES.ps1<br /> ##  AUTHOR.........:  Clint McGuire<br /> ##  WEBSITE........:  www.clintmcguire.com<br /> ##  EMAIL..........:<br /> ##  VERSION........:  1<br /> ##  DATE...........:  2011_04_05<br /> ##  COPYRIGHT......:  2011, Clint McGuire<br /> ##  LICENSE........:<br /> ##  REQUIREMENTS...:  Powershell v2.0<br /> ##<br /> ##  DESCRIPTION....:  Shuts down BES services then restart in proper order<br /> ##<br /> ##  NOTES..........:<br /> ##  CUSTOMIZE......:<br /> ##==============================================================================<br /> ##  REVISED BY.....:<br /> ##  EMAIL..........:<br /> ##  REVISION DATE..:<br /> ##  REVISION NOTES.:<br /> ##<br /> ##==============================================================================<br /> ##==============================================================================<br /> <span style="color: #0000ff;"><br /> ##==============================================================================<br /> ##  START<br /> ##==============================================================================<br /> <span style="color: #0000ff;"><br /> $Services = "Blackberry Attachment Service", "Blackberry Alert", "Blackberry MDS Connection Service", "Blackberry Controller", "Blackberry Dispatcher", "Blackberry Router"<br /> Foreach ($Service in $Services)<br /> {<br /> Stop-Service $Service -Force<br /> $GSService = Get-Service $Service<br /> $ServiceStatus = $GSService.Status<br /> "$Service is now " + $ServiceStatus<br /> }<br /> "All Services are Stopped, will start services."<br /> <span style="color: #0000ff;"><br /> $Services = "Blackberry Router", "Blackberry Dispatcher", "Blackberry Controller", "Blackberry MDS Connection Service", "Blackberry Alert", "Blackberry Attachment Service"<br /> Foreach ($Service in $Services)<br /> {<br /> Start-Service $Service<br /> $GSService = Get-Service $Service<br /> $ServiceStatus = $GSService.Status<br /> "$Service is now " + $ServiceStatus<br /> }<br /> ##==============================================================================<br /> ##  END<br /> ##==============================================================================</code></p> 
<p><a href="http://feedads.g.doubleclick.net/~a/gBC7qcv6eecDjC2S7yQ55_Cm7WA/0/da"><img src="http://feedads.g.doubleclick.net/~a/gBC7qcv6eecDjC2S7yQ55_Cm7WA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/gBC7qcv6eecDjC2S7yQ55_Cm7WA/1/da"><img src="http://feedads.g.doubleclick.net/~a/gBC7qcv6eecDjC2S7yQ55_Cm7WA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/ClintMcguire/~4/c4JE64DK0vM" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.clintmcguire.com/2011/04/15/restart-bes-4-1-x-services-with-powershell/feed/</wfw:commentRss> <slash:comments>2</slash:comments> <feedburner:origLink>http://www.clintmcguire.com/2011/04/15/restart-bes-4-1-x-services-with-powershell/</feedburner:origLink></item> </channel> </rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Object Caching 751/897 objects using disk: basic
Content Delivery Network via Amazon Web Services: S3: img.clintmcguire.com

Served from: clintmcguire.com @ 2012-02-03 14:00:15 -->

