tag:blogger.com,1999:blog-30094231432841479572024-02-20T11:06:39.732+01:00Do IT SmarterIT in the smart way, where all tasks will be considered trivial if done more than twice.Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-3009423143284147957.post-61434887798241426352013-04-03T17:42:00.002+02:002013-04-03T23:28:46.518+02:00Start-RDP PowerShell cmdlet<h2>Start-RDP cmdlet</h2><br />
I have for a long time been irritated about the missing RDP support in PowerShell. And for that reason i have created a wrapper function that can start RDP sessions without having to enter credentials in all sessions.<br />
<br />
The code can be found over at <a href="http://poshcode.org/embed/4068" target="_blank">PoshCode.Org/embed/4068</a> or below.<br />
<script src="http://PoshCode.org/embed/4068" type="text/javascript"></script><br />
<br />
Regards<br />
<br />
AllanAnonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-3784830648737055232012-01-23T10:27:00.002+01:002012-01-25T09:48:29.461+01:00Powershell SVmotion Move VM one HD at a time<div class="gmail_quote">When i had to move some rather big vm's with 5-15 HD's and a size of 3-6TB attached, I wanted to ensure the vm didn't get corrupt. SO i wondered f it was possible to move vm's one HD at a time. and yes it is. but previously you had to do it via some very tricky calls to the api now its just a cmd-let that handles it.<br />
<br />
<blockquote class="gmail_quote" style="border-left-color: rgb(204,204,204); border-left-style: solid; border-left-width: 1px; margin-bottom: 0px; margin-left: 0.8ex; margin-right: 0px; margin-top: 0px; padding-left: 1ex;"><span style="font-family: 'courier new', monospace;">Param($Name="",$Datastore="")<br />
$vm= get-vm $name<br />
if (($vm) -and (get-datastore $datastore)) {<br />
<span style="white-space: pre-wrap;"> </span>$Harddisks = Get-HardDisk -vm $vm<br />
<span style="white-space: pre-wrap;"> </span>Foreach ($hd in $harddisks) {<br />
Set-HardDisk -HardDisk $hd -Datastore $datastore -Confirm:$false<br />
<span style="white-space: pre-wrap;"> </span>}<br />
<span style="white-space: pre-wrap;"> </span>$vm | move-vm -datastore $datastore -Confirm:$false<br />
}</span></blockquote><div><br />
</div></div>The script explained. first i find the vm, and the target datastore. then i step through the HD's one by one and use the set-harddisk cmd-let to place the HD on the target datastore. at the end i move the remainig part of the vm thats the vmx file, logs and so to the target drive.<br />
<br />
This was done on ESX5i, vcenter5.0 and PowerCLI 5.0Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-81152924785934603092010-08-10T11:04:00.001+02:002010-08-10T11:04:23.743+02:00Do a task in your sleep. :-P<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: medium; border-collapse: collapse; "><div id=":12r" class="ii gt" style="font-size: 13px; margin-top: 5px; margin-right: 15px; margin-bottom: 5px; margin-left: 15px; padding-bottom: 20px; "> <div id=":12q">Have you had to start a logtime running script at inhuman hours, and never really found a way to do this except through the task manager. I created this small script that will accept any input and pass it along the pipe. Just prep the command and start it and it will look like starting at the specified time.<div> <br></div><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> <div><div><span style="font-size: x-small; "><font face="'courier new', monospace">Param (</font></span><span style="white-space: pre-wrap; "><span style="font-size: x-small; "><font face="'courier new', monospace"> </font></span></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> [Parameter(Position=0, ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]$itemlist,</font></span></div></div> <div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> $ContinueAt="")</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"><br> </font></span></div></div><div><span style="font-size: x-small; "><font face="'courier new', monospace"># ContinueAt format "YYYYMMDDHHmm"</font></span></div><div><span style="font-size: x-small; "><font face="'courier new', monospace"><br> </font></span></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace">BEgin {</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> $now = get-date</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"><br></font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> If ($ContinueAt -ne "") {</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> $When = Get-date -year $ContinueAt.Substring(0,4) -Month $ContinueAt.SubString(4,2) -day $ContinueAt.Substring(6,2) -Hour $ContinueAt.Substring(8,2) -Minute $ContinueAt.Substring(10,2)</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"><br></font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> while ($now -lt $when) {</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> Write-Verbose "Sleeping until: $ContinueAt"</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> Sleep 10</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> $now = get-date</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> }</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> }</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> Write-verbose "Done Sleeping"</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace">}</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace">PROCESS{</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> Foreach ($item in $itemlist) {</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> $item</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace"> }</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace">}</font></span></div> </div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace">END {</font></span></div></div><div><div><span style="font-size: x-small; "><font face="'courier new', monospace">} </font></span></div> <div><span style="font-family: 'courier new', monospace; font-size: x-small; "><br></span></div></div></blockquote><font face="arial, helvetica, sans-serif">Hope this helps someone out there.</font></div><div><font face="arial, helvetica, sans-serif"><br> </font></div></div><div id=":131" class="hq gt" style="font-size: 13px; margin-top: 5px; margin-right: 15px; margin-bottom: 15px; margin-left: 15px; clear: both; "></div><div class="hi" style="background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(227, 233, 240); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; width: auto; border-bottom-left-radius: 6px 6px; border-bottom-right-radius: 6px 6px; background-position: initial initial; background-repeat: initial initial; "> </div><div class="gA gt" style="font-size: 13px; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(227, 233, 240); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; width: auto; border-bottom-left-radius: 6px 6px; border-bottom-right-radius: 6px 6px; background-position: initial initial; background-repeat: initial initial; "> </div></span> Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-57429641307838749032009-09-10T20:42:00.003+02:002010-03-14T09:22:05.419+01:00Powershell ESX Lun Balance scriptBack again from a long break. I found out that many of the unix based scripts are going to be obsolete within a couple of month. so here is a powershell version of my earlier published script. Thanks to Justin Emerson, <a href="http://vmjunkie.wordpress.com/" target="_blank">http://vmjunkie.wordpress.com/</a> for the basics of this script. a little copy paste and some mods.<br />
<div><div></div><div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"></span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><blockquote><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># Cluster/host lun balance script</span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"># Allan Christiansen <a href="http://doitsmarter.blogspot.com/">http://doitsmarter.blogspot.com/</a></span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Write-Host "This script will modify the policy of all your shared LUNs on all ESX Servers" -ForegroundColor Cyan</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Write-Host "in a Cluster to Fixed and select a preferred path in a round-robin fashion." -ForegroundColor Cyan</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">#</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">if ($args.Length -lt 2) {</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Write-Host "usage: -c or -s "</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">exit 1</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">} else {</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">if ($args[0] -eq "-c") { $VMHosts = Get-Cluster $args[1] | Get-VMHost }</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">if ($args[0] -eq "-s") { $VMHosts = Get-VMHost $args[1] }</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">}</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Write-Host "Modifiying ESX hosts:" $VMHosts</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">foreach ($VMHost in $VMHosts)</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">{</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$luns = $VMHost|get-scsilun -luntype disk| where-object {$_.ConsoleDeviceName -like "/vmfs/devices/disks/vml*"}| Where-object {$_.CanonicalName -notlike "vmhba32*"} |Sort-Object CanonicalName</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$firstLUNPaths = Get-ScsiLunPath $luns[0]</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$numPaths = $firstLUNPaths.Length</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$count = 0</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">foreach ($lun in $luns)</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">{</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">"count : $count"</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">"numpath : $numPaths"</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$lun.CanonicalName</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">if ($count -ge $numPaths) { $count = 0 }</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$paths = Get-ScsiLunPath -ScsiLun $lun</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$paths</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$lun|Set-ScsiLun -MultipathPolicy Fixed -PreferredPath $paths[$count]</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">$count += 1</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># Sleep for some seconds as some arrays dont like doing this too fast. and with running vm's its .....</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Start-Sleep -Seconds 3</span></div><div><span style="white-space: pre;"></span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">}</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">}</span></div><div><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># Thanks to Justin Emerson, </span><a href="http://vmjunkie.wordpress.com/" target="_blank"><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">http://vmjunkie.wordpress.com</span></a><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> for the basics of this.</span></div></blockquote></span></div><div></div></div></div>Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-54894327737256805332009-02-10T20:19:00.001+01:002009-02-10T20:21:36.004+01:00ESX iscsi enable script using vi-toolkit.Below is a script for enabling and rescanning Iscsi target for valid vmfs volumes. I'm using Vi-Toolkit for this.<b><br> <br> </b> <blockquote><b><tt>Param ($VMhost = "") </tt></b><br> <b><tt>$iscsiHba = "vmhba32" </tt></b><br> <b><tt>$iscsiServer = "Iscsi-SAN-IP" </tt></b><br> <b><tt>$iscsiPort = 3260 </tt></b><br> <b><tt>$target = New-Object VMware.Vim.HostInternetScsiHBASendTarget </tt></b><br> <b><tt>$target.address = $iscsiServer </tt></b><br> <b><tt>$target.port = $iscsiPort </tt></b><br> <b><tt>$iscsiauthprop = New-Object VMware.Vim.HostInternetScsiHbaAuthenticationProperties </tt></b><br> <b><tt>#$iscsiauthprop.ChapAuthEnabled = "true" </tt></b><br> <b><tt>#$iscsiauthprop.ChapName = "Chapuser" </tt></b><br> <b><tt>#$iscsiauthprop.ChapSecret = "ChapSecret" </tt></b><br> <b><tt>$h = Get-VMHost $VMhost </tt></b><br> <b><tt>Foreach ($hostView in ( Get-View -VIObject $h)) { </tt></b><br> <b><tt> $storageSystem = Get-View $hostView.configManager.storageSystem </tt></b><br> <b><tt> # Enable software iSCSI controller </tt></b><br> <b><tt> $storageSystem.UpdateSoftwareInternetScsiEnabled($true) </tt></b><br> <b><tt> # Add iSCSI Server for dynamic discovery </tt></b><br> <b><tt> $storageSystem.AddInternetScsiSendTargets($iscsiHba, $target) </tt></b><br> <b><tt> $storageSystem.UpdateInternetScsiAuthenticationProperties($iscsiHba,$iscsiauthprop) </tt></b><br> <b><tt> # Scan for iSCSI devices </tt></b><br> <b><tt> $storageSystem.RescanHba($iscsiHba) </tt></b><br> <b><tt>}<br> <br> </tt></b></blockquote> I used this for setting the same settings for all my hosts and ensuring that they all are 100% alike.<br> Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-25153200940232614972008-10-17T13:40:00.001+02:002008-10-17T13:41:43.751+02:00List vm usage and assosiated datastore<div dir="ltr"><div>Hi all,</div> <div> </div> <div>in a fairly large environment the tracking of a VM's Disk usage and the datastore on who i resides i a trivial task.</div> <div> </div> <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> <div>$datastoreExp = @{N="Datastore"; E={ ($_ | get-datastore | select-object -first 1).Name }} <div>$diskSizeExp = @{N="Total Disk"; E={ ($_ | get-harddisk | measure-object -property CapacityKB -sum).Sum }}</div> <div>get-vm | select Name, $datastoreExp, $diskSizeExp | sort -property Datastore,"Total Disk" </div> <div></div></div></blockquote> <div> This small PowerShell script pulls a list of all VMs and the disk ussage pr. vm and on witch datastore it is connected to/placed. Be aware if an iso is mounted from a datastore this will generate an aditional entry for the VM in question.</div> </div> Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-29359718099130278002008-09-18T07:38:00.001+02:002008-09-18T07:40:37.833+02:00Updating tools on VM's in Vmware<div dir="ltr"><div>Hi </div> <div> </div> <div>I'm back, after a long break, with other important stuff on the horizon. I realize i have a couple of hundred vm's that needed the tools to be update and i didn't want to do it manually one by one. So i again looked into the VI-toolkit for Vmware and found it pretty easy to update all vm's with a simple script.</div> <div> </div> <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> <div>$VmList = Get-VM | Where-Object {$_.Powerstate -eq "PoweredON"} | % { Get-View $_.ID } | where {$_.guest.toolsstatus -notmatch "Ok"} | Select Name<br>foreach ($vm in $VmList) { <br> "Updating :" $vm<br> Update-Tools $vm<br>}</div> <div> </div></blockquote> <div dir="ltr">I hope this can help others.</div> <div><br></div></div> Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-79085271460144055972008-07-28T11:27:00.003+02:002008-09-18T07:47:41.629+02:00Disable and Turn Off IPv6 Support in Vista<div dir="ltr"><h1 id="post-4863"> </h1><div class="inlineadsense"></div><div class="entrytext"><p>IPv6 (Internet Protocol version 6) is the successor for IPv4, the current version of most popular network layer protocol for packet-switched internetworks used on the Internet. In Windows Vista, IPv6 is fully implemented and supported, is also installed and enabled by default, with full Internet Protocol security (IPsec) support for IPv6 traffic and Teredo tunneling support for non-IPv6 aware devices.<br /><span id="more-4863"></span><br />IPv6 is not common yet, as most software, routers, modems, and other network equipments does not support the emerging and future-proof protocol yet. Beside, turning off IPv6 support does not affect the functionality of Internet browsing for average users. Thus IPv6 and/or Teredo can and (quite likely) should be disabled if it's not in use to conserve system resources. Unlike Windows XP, IPv6 in Windows Vista cannot be uninstalled, according to <a onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.microsoft.com/technet/community/columns/cableguy/cg0506.mspx');" href="http://www.microsoft.com/technet/community/columns/cableguy/cg0506.mspx">Microsoft</a>. However, IPv6 can be disabled. The following guide will allow users to disable IPv6 on a specific connection of a network interface card.</p><ol><li>Go to Network Connections folder (click on Start button, then right click on Network, select Properties, then click on "Manager network connections" on Tasks pane). <li>You should see various LAN, wireless, Bluetooth, high speed Internet, and other network connections available on the Vista computer with the network adapter description. Right click on the network connection that you want to disable the IPv6 interface and select "Properties". <p>Click "Continue" on User Access Control permission request prompt. </p><li>Clear the check box next to the <strong>Internet Protocol version 6 (TCP/IPv6)</strong> component in the list under "This connection uses the following items" box. <p> </p><li>Click OK when done. <li>To re-enable IPv6, tick back the check box. </li></li></li></li></li></ol><p>This method disables IPv6 on the particular LAN interface and connection. For other network adapter or connection, users have to repeat the steps to disable IPv6. Beside, disable IPv6 also does not disable IPv6 on tunnel interfaces or the IPv6 loopback interface.</p><p>It's also possible to disable IPv6 and/or Teredo via Vista system registry. The registry settings also allow users to selectively disable components and configure behaviors for IPv6 in Windows Vista. </p><ol><li>Open Registry Editor (regedit). <li>Navigate to the following registry key branch: <p><code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\<br />Services\tcpip6\Parameters\</code></p><li>Create the following registry value (DWORD type): <p>DisabledComponents</p><p>Note that the name must be exactly as shown, including capitalization. DisabledComponents is set to 0 by default. </p><li>The DisabledComponents registry value is a bit mask that controls the following series of flags, starting with the low order bit (Bit 0). To determine the value of DisabledComponents for a specific set of bits, the process is complicated, were hexadecimal value is calculated from binary number of the bits in correct position. For convenient, the following table lists some common configuration combinations and the corresponding DWORD value of DisabledComponents.<br /><table><thead><tr valign="top"><td>Configuration combination</td><td>DisabledComponents value</td></tr></thead><tbody><tr valign="top"><td>Disable all tunnel interfaces</td><td>0×1</td></tr><tr valign="top"><td>Disable 6to4</td><td>0×2</td></tr><tr valign="top"><td>Disable ISATAP</td><td>0×4</td></tr><tr valign="top"><td>Disable Teredo</td><td>0×8</td></tr><tr valign="top"><td>Disable Teredo and 6to4</td><td>0xA</td></tr><tr valign="top"><td>Disable all LAN and PPP interfaces</td><td>0×10</td></tr><tr valign="top"><td>Disable all LAN, PPP, and tunnel interfaces</td><td>0×11</td></tr><tr valign="top"><td>Prefer IPv4 over IPv6</td><td>0×20</td></tr><tr valign="top"><td>Disable IPv6 over all interfaces and prefer IPv4 to IPv6</td><td>0xFF</td></tr></tbody></table><p>As seen from table above, to disable IPv6 support globally on all interface, set the value data for DisabledComponents to <strong>000000FF</strong>, or simply <strong>FF</strong>. The registry entry will look like below:</p><p><code><br />[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters]<br />"DisabledComponents"=dword:000000ff<br /></code></p><li>Restart the computer for changes to take effect. <li>To revert and enable IPv6, delete "DisabledComponents" registry key or set its registry value to 0. <br clear="all"></li></li></li></li></li></li></ol></div></div>Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-29158339873296351262008-07-22T08:08:00.001+02:002008-07-22T08:15:09.310+02:00Sending mail from Esx 3.x servers<div dir="ltr"><div>So now i'm back from holiday and was wondering what has happened in my production ESX environment. Well thats not so easy to find out unless you have set up some logging and reporting.</div> <div> </div> <div>To do that easy you need to be able to send emails from the ESX servers. By default that is disabled. But it is very easy to overcome. download the MIME-Lite-3-0-1 module from <a href="http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm">http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm</a> install it by:</div> <div> </div> <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> <div><font face="courier new,monospace">tar zxfv MIME-Lite-3.01.tar.gz</font></div> <div><font face="courier new,monospace">cd MIME-Lite-3.01</font></div> <div><font face="courier new,monospace">perl Makefile.PL</font></div> <div><font face="courier new,monospace">make test</font></div> <div><font face="courier new,monospace">make install</font></div> <div> </div></blockquote> <div>Then you should be ready to send mails by using the smtp_send.pl script from <a href="http://www.jeremypries.com/wp-content/plugins/wp-downloadMonitor/download.php?id=5">http://www.jeremypries.com/wp-content/plugins/wp-downloadMonitor/download.php?id=5</a></div> <div> </div> <div>Then it should just be creating the reports you want in the various cron libraries.</div> <div> </div> <div>Btw the esx-diag tool from Veem tells a great deal on the configuration status of your ESX servers.<br clear="all"></div></div> Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-68697922768290846912008-06-21T21:31:00.001+02:002008-06-21T21:32:11.097+02:00ESX LUN Load balanceAfter having fighting my way through the Virtual Client setting the active and preferred path for all my currently 22 Lun's on my 24 ESX servers to load balance the load over as many HBA's as possible i looked at the script i could find on the net and saw that the scripts all set the paths to the same for all hosts. <div> </div> <div>I was looking at different scripts out there and found the one below. I need an idea on how to randomize some of this because otherwise it will always be the same om all hosts and if there are 4 hba' as in my case the fourth one will newer be used. I need to set the counter to some random number between 1 and the PATHS value for the hba assignment to start somwhere.. :</div> <div>#! /bin/bash</div> <div>#</div> <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> <div><font face="courier new,monospace"># by Allan Christiansen/2008 on esx 3.5.0 Update 1</font></div> <div><font face="courier new,monospace">#</font></div> <div><font face="courier new,monospace">for PATHS in 2 4 6 8 10 12 14 16</font></div> <div><font face="courier new,monospace">do</font></div> <div><font face="courier new,monospace"> STPATHS=${PATHS}</font></div> <div><font face="courier new,monospace"> COUNTER=${RANDOM}</font></div> <div><font face="courier new,monospace"> while [[ ${COUNTER} -gt ${PATHS} ]];</font></div> <div><font face="courier new,monospace"> do</font></div> <div><font face="courier new,monospace"> COUNT=`expr ${COUNTER} / ${PATHS}`</font></div> <div><font face="courier new,monospace"> COUNTER=${COUNT}</font></div> <div><font face="courier new,monospace"> done</font></div> <div><font face="courier new,monospace"> for LUN in $(esxcfg-mpath -l | grep "Disk" | grep "has ${STPATHS} paths" | awk '{print $2}')</font></div> <div><font face="courier new,monospace"> do</font></div> <div><font face="courier new,monospace"> esxcfg-mpath --lun=${LUN} --path=$(esxcfg-mpath -q --lun=${LUN} | grep FC | awk '{print $4}' | awk '{print NR "S\t " $0}' | grep ${COUNTER}S | awk '{print $2}') --preferred</font></div> <div><font face="courier new,monospace"> COUNT=`expr ${COUNTER} + 1`</font></div> <div><font face="courier new,monospace"> COUNTER=${COUNT}</font></div> <div><font face="courier new,monospace"> if [[ ${COUNTER} -gt ${STPATHS} ]]</font></div> <div><font face="courier new,monospace"> then</font></div> <div><font face="courier new,monospace"> COUNTER="1"</font></div> <div><font face="courier new,monospace"> fi</font></div> <div><font face="courier new,monospace"> done</font></div> <div><font face="courier new,monospace">done</font></div> <div><font face="courier new,monospace"> </font></div> <div><font face="courier new,monospace"> </font></div></blockquote> Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-48643340744183934442008-06-19T15:52:00.003+02:002008-06-19T15:56:14.497+02:00Windows Vista Power ButtonAfter a couple of month with Windows Vista i found that the default behavior of the start menu Power button anoyed me alot, especialy on my Desktop pc. I was researching and playing around and found how to change what the start buttons do.. You can change how the shutdown/sleep buttons function in local group policies (gpedit.msc) COMPUTER CONFIGURATION > ADMINISTRATIVE TEMPLATES > SYSTEM > POWER MANAGEMENT > BUTTON SETTINGS<br /><br />Changing these values will resolve this idiotic default idea that MS came up with of pressing the power button and it going to sleep....<br /><br />Another way is in the advanced power settings.<br /><img style="WIDTH: 419px; HEIGHT: 446px" src="http://www.arsgeek.com/wp-content/uploads/2007/05/shutdown.JPG" /><br /><br />I hope that this can help you out a bit.Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-10504271527499004112008-06-17T22:37:00.003+02:002008-06-19T19:25:30.097+02:00Vmware ESX<p>I have for some time been using vmware ESX and found that the software from them is perfect for the growing IT environment that exists in a majority of companies. But i also discovered that managing an environment that is growing fast needs a lot of care and strict procedures. e.g. with vmware there is a possibility to move a vm from one host to another host without user interruption. This is sadly only possible if the cdrom drives are not locked to a iso or otherwise occupied.</p><p>I found that running this small powershell script helps alot on that.</p><span style="font-family:courier new,monospace;"><blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span style="font-family:courier new,monospace;">Get-VM Get-CDDrive ? { $_.ConnectionState.Connected -eq "true" } Set-CDDrive -Connected:$false -Confirm:$false</span></blockquote></span><p>This also is a great small script to have in mind when evacuating an ESX. there's nothing more annoying than the last vm will not evacuate because of a mounted cdrom drive or a not ended tools install.</p><p>BTW. Thanks alot to Microsoft for the powershell. And for vmware for implementing it in such a great fashion. <br clear="all"></p>Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.comtag:blogger.com,1999:blog-3009423143284147957.post-12289273275784651642008-06-05T07:29:00.003+02:002008-06-05T07:48:30.090+02:00Just another IT Blog? orIs this just another IT blog?<br /><br />Yes and no. Yes its a IT blog. and no this is one where i will share the small scripts, gadgets and sniplets i create or piece together from my daily work and travels around the net.<br /><br />So who am I:<br /><br />Name : Allan Christiansen<br />Age : 37 at the moment (Born 1970)<br /><br />Experience : 20 years of Professional IT. Mostly with Microsoft products but i have also worked some time with Linux. Lately I have worked alot with vmware.<br /><br />Exams : MCSE 2003 : Messaging / MCSE 2003 : Security / MCTS SQL 2005 / MCP<br /><br />Hope to see you all around and please have fun while working. It makes it easier to relax.Anonymoushttp://www.blogger.com/profile/06860593281337266526noreply@blogger.com