Coding

Export and Import VMware affinity rules

Posted on

More searching for migration of my VCenter and I found http://ict-freak.nl/2009/09/06/powercli-export-and-import-drs-rules-v2/ which allows me to export and import the affinity rules Export Get-Cluster -Name “TUK_UT_04” | Get-DrsRule | `Export-CliXml ‘d:tempAffinityRules.xml’ Import ForEach ($rule in (Import-CliXml ‘d:tempAffinityRules.xml’)){    New-DrsRule -Cluster (Get-Cluster -Name “TUK_UT_04”) `    -Name $rule.Name -Enabled $rule.Enabled `    -KeepTogether $rule.KeepTogether `    -VM (Get-VM -Id $rule.VmIds)}

VMware

Export and Import VMware customization specs

Posted on

While looking for ways to migrate to our new VCenter server, I came across http://www.van-lieshout.com/2009/07/export-and-import-customization-profiles-using-powershell/ which describes how to export your customization specs (passwords and all) and then reimport them into the new VC. Export $path=”d:temp”#Export Customization Profiles$view = get-view CustomizationSpecManagerForEach ($CustomizationProfile in $view.info) { $xml = $view.CustomizationSpecItemToXml($view.GetCustomizationSpec($CustomizationProfile.name)) $xml | Out-File ($path + “” + […]

VMware

Script to migrate to new VCenter

Posted on

We are looking at building a new VCenter on new x64 hardware with a new DB server and were struggling with how to migrate our environment from one server to the other. Thanks to the script at http://technodrone.blogspot.com/2010/01/vcenter-powercli-migration-script.html, it looks like this may be an easy task.It appears that some properties (such as affinity rules) […]

SQL

TSQL script to shrink all log files

Posted on

I got alerted over the weekend to a SQL server running out of disk space on one of its drives. Upon further inspection, several of the LOG files had grown and were filling the log drive. I went to shrink the files, but realized there must be a better way. A little googling and I […]

Coding

Executing commands in a VM via powershell

Posted on

I got to thinking today that when you tell a VM to shutdown the OS, it is actually executing a command against the VM itself, not just in VMware. I decided to do a little searching to see what it takes to do something similar with other commands (such as srvinfo, or listing disk usage) […]

Coding

Powershell to disconnect CD and Floppy drives in ESX

Posted on

This script will enumerate all VMs and disconnect all CDs and Floppy drives get-cddrive -VM * |where {$_.ISOPATH -ne $null}|set-cddrive -nomedia -Confirm:$Falseget-cddrive -VM * |where {$_.HOSTDevice -ne $null}|set-cddrive -nomedia -Confirm:$Falseget-FloppyDrive -VM * |where {$_.FloppyImagePath -ne $null}|set-FloppyDrive -nomedia -Confirm:$Falseget-FloppyDrive -VM * |where {$_.HOSTDevice -ne $null}|set-FloppyDrive -nomedia -Confirm:$False

Coding

Syntax highlighting in blogger

Posted on

http://www.cyberack.com/2007/07/adding-syntax-highlighter-to-blogger.html List of brushes http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ Brush name Brush aliases File name ActionScript3 as3, actionscript3 shBrushAS3.js Bash/shell bash, shell shBrushBash.js ColdFusion cf, coldfusion shBrushColdFusion.js C# c-sharp, csharp shBrushCSharp.js C++ cpp, c shBrushCpp.js CSS css shBrushCss.js Delphi delphi, pas, pascal shBrushDelphi.js Diff diff, patch shBrushDiff.js Erlang erl, erlang shBrushErlang.js Groovy groovy shBrushGroovy.js JavaScript js, jscript, javascript shBrushJScript.js […]

Coding

VBScript to list the OS Version of all computers in domain

Posted on

In a large environment, inventory information can quickly be out of date. Below is a script that searches AD for all computers and then reports the OS from each system. The OS information comes from the target computer, so firewalls and power state is important. ‘OSVersion.vbson error resume nextConst ADS_SCOPE_SUBTREE = 2strDomain = “mydomain.com”Set objConnection […]

Coding

VBScript to list file owner and other attributes

Posted on

Occasionally I need to look at the owner of a file or group of files. The below script helps me enumerate a folder and list the file attributes ‘GetOwner.vbsSet objShell = CreateObject (“Shell.Application”)Set objFolder = objShell.Namespace (“D:toolsAD”)Set objFSO = CreateObject(“Scripting.FileSystemObject”)Dim arrHeaders(13)For i = 0 to 13    arrHeaders(i) = objFolder.GetDetailsOf (objFolder.Items, i)NextFor Each strFileName in objFolder.Items    […]