Easy way to create a PSObject

I always forget the syntax to this, so here you go.

$outputs = @();
$output = New-Object -TypeName PSObject -Property @{
	Name = $vm.Name
	Path = $($disk.Path)
	Capacity = $($disk.Capacity/1GB)
	FreeSpace = $($disk.FreeSpace/1GB)
	Storage = $($ds -join "  ")
}
$outputs += $output

Get Guest VM Drive Sizes

Quick post on how to get the drive sizes and free space on said drives on VMWare Virtual Machines.  Props to this forum post.  I ran this on our esx’s and was able to identify over 2 terabytes of unused space.  Very handy.

cls

$user = 'UserName'
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $user, (get-content "c:\credentialFile.txt" | convertto-securestring )
#Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -WarningAction SilentlyContinue
$visrv = Connect-VIServer -Server Server -Credential $cred

$dataCenter = Get-Datacenter -Name Location 

if(Test-Path('c:\ServerList.csv'))
{
	Remove-Item -Path c:\ServerList.csv -force
}

Get-VM -Location $dataCenter | %{ $vmName = $_.Name;
	$_.Guest.Disks | where{($_.FreeSpace/1GB) -gt 50} | Select `
			@{Name = "VirtualMachine"; E={$vmName}}, `
			@{Name = "Path"; E={$_.Path}}, `
			@{Name = "Capacity(GB)";E={[System.Math]::Round($_.Capacity/1GB, 1)}}, `
			@{Name = "FreeSpace(GB)";E={[System.Math]::Round($_.FreeSpace/1GB, 1)}}  
} | Export-Csv -Path 'c:\ServerList.csv'

Disconnect-VIServer -Server $visrv -Force

Install Litespeed 5.2 on Windows 2008 Cluster

If you run into any errors (GAC errors or access denied errors) when installing Litespeed (in my case, version 5.2) on a Windows 2008 Cluster, here are the steps to get the install working correctly. 

Note, if you’re doing an install on an active\active cluster, only do one cluster at a time.  This will not work for installing on both clusters at once. 

  • Add the computer account to the administrators’s group of the current computer to the 2nd node in the cluster.  For example, Node1 = Yoda, Node2 = Luke.  If you’re installing on Yoda, go to Luke and add the Yoda node to it.  If the name is not resolving, you forgot to add computers to the object types.

image

  • If this is an active\active cluster, copy the install to the other node, copy the current computer account over to the other node, and do the install again, except reference the cluster where litespeed has not been installed on yet.

I did this on an active\active cluster and each node had only 1 cluster on it when doing the install, and it worked for me.  Don’t forget, do NOT do both nodes at once.  Even if you add both computer accounts to their opposite nodes, it still will not work (at least in my case it didn’t). 

One final note, don’t forget to remove the computers from the administrators groups on the machines.

Add a remote server to your local SSIS instance

In order to add a remote server to your local instance of ssis you have to add said instance to your config file for ssis.  The location of your config file for ssis is C:\Program Files\Microsoft SQL Server\110\DTS\Binn\MsDtsSrvr.ini.xml  (if on x64). 

<?xml version="1.0" encoding="utf-8"?>
<DtsServiceConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <StopExecutingPackagesOnShutdown>true</StopExecutingPackagesOnShutdown>
  <TopLevelFolders>
    <Folder xsi:type="SqlServerFolder">
      <Name>MSDB</Name>
      <ServerName>.\DENALI</ServerName>
    </Folder>
    <Folder xsi:type="SqlServerFolder">
      <Name>WhateverServerYouWantToConnectTo</Name>
      <ServerName>ServerName\InstanceName</ServerName>
    </Folder>
    <Folder xsi:type="FileSystemFolder">
      <Name>File System</Name>
      <StorePath>..\Packages</StorePath>
    </Folder>
  </TopLevelFolders>
</DtsServiceConfiguration>

After you’ve added the server, you’ll need to restart the Integration Services service on your local machine.  Then, open up the integration services on your local machine, expand the Stored Packages node and you should see the machine that you just added.

SSIS

Log Backup Chain

If you break your log backup chain by switching a database into simple recovery or by executing BACKUP LOG WITH NO_LOG and WITH TRUNCATE_ONLY, there is a misconception that you then have to do a full backup in order to get your transaction log backups to run again.  This is incorrect.  Once you switch your recovery model back to full you only have to do a differential backup in order to restore the chain.

See Paul Randal’s blog post for more information (and an example script to demonstrate this).