PowerShell One-Liner: SC Series storage class and RAID level allocations

Posted Leave a commentPosted in Compellent, Dell, PowerShell

With the PowerShell SDK for Dell EMC SC Series arrays, you can easily retrieve volume information including allocated, free, and used space.  But what if you’re looking for RAID allocations on the entire array?  Like how much RAID10, RAID5 or RAID6 is allocated across all of your tiers?  That’s easy too:

Get-DellScStorageTypeClass -ConnectionName <connectionName> | foreach { Get-DellScStorageTypeClassStorageUsage $_.InstanceId -ConnectionName <connectionName> } | Select AllocatedSpace,FreeSpace,UsedSpace,InstanceName | ft

From these couple handy cmdlets strung together, you’ll get exactly what you’re looking for:

Enjoy!

PowerShell: Dynamic generation of an iCal/vCalendar (ICS) format file

Posted Leave a commentPosted in PowerShell

Generating your own custom calendar or event invites in the iCal (vCalendar) format is pretty easy, once you’ve read the 140+ page spec.

Actually, it’s a pretty complex but flexible way to build schedule items.  Just think about the possibly combinations that exist when you create a new meeting request or appointment in Outlook or your preferred calendar application.  You get recurrences, descriptions, summaries, invitees, location, start time, end time, all-day…. and the list goes on and on.

For this example, we’ll keep it simple and walk through building a function for an event with a yearly recurrence; something like a birthday or an anniversary.

The first part of this function is going to put together some of variables for building out the ICS file.  In this case, the function is going to ask for input for all the fields.  To truly automate, you’ll want to suck this information in from a file or another datasource since you’ll want to minimize the user intervention.

function CreateNewEvent {

# Custom date formats that we want to use
$longDateFormat = "yyyyMMddTHHmmssZ"
$dateFormat = "yyyyMMdd"

# Prompt the user for the start date in a specific format
$startDate = Read-Host -Prompt 'Enter the start date of the event in the format "yyyymmdd"'

# Give the event a name specified by the user
$eventSubject = Read-Host -Prompt 'Enter the event subject'

# This field is optional, but let's ask for the details (description)
$eventDesc = Read-Host -Prompt 'Enter the event description summary (optional)'

# Provide location information (also optional)
$eventLocation = Read-Host -Prompt 'Enter the event location (optional)'

Now that we have all of the info, we’ll start to build out the internal parts of the file.  For this part, we’re going to use the .NET StringBuilder class.  This will help us “string” the pieces together easily.  The first part of this file needs to contain information critical to the spec.

# Instantiate .NET StringBuilder
$sb = [System.Text.StringBuilder]::new()

# Fill in ICS/iCalendar properties based on RFC2445
[void]$sb.AppendLine('BEGIN:VCALENDAR')
[void]$sb.AppendLine('VERSION:2.0')
[void]$sb.AppendLine('METHOD:PUBLISH')
[void]$sb.AppendLine('PRODID:-//Braunweb//PowerShell ICS Creator Sample//EN')

Next, we’ll start to add the details that we collected about the event earlier.  This information is part of the VEVENT “object”.  The VCALENDAR “object” can contain multiple VEVENT definitions.  In our case, we’re keeping it to a single event.

[void]$sb.AppendLine('BEGIN:VEVENT')
[void]$sb.AppendLine("UID:" + [guid]::NewGuid())
[void]$sb.AppendLine("CREATED:" + [datetime]::Now.ToUniversalTime().ToString($longDateFormat))
[void]$sb.AppendLine("DTSTAMP:" + [datetime]::Now.ToUniversalTime().ToString($longDateFormat))
[void]$sb.AppendLine("LAST-MODIFIED:" + [datetime]::Now.ToUniversalTime().ToString($longDateFormat))
[void]$sb.AppendLine("SEQUENCE:0")
[void]$sb.AppendLine("DTSTART:" + $startDate)
[void]$sb.AppendLine("RRULE:FREQ=YEARLY;INTERVAL=1")
[void]$sb.AppendLine("DESCRIPTION:" + $eventDesc)
[void]$sb.AppendLine("SUMMARY:" + $eventSubject)
[void]$sb.AppendLine("LOCATION:" + $eventLocation)
[void]$sb.AppendLine("TRANSP:TRANSPARENT")
[void]$sb.AppendLine('END:VEVENT')

Once we’ve defined our event, we close out the “objects”.

[void]$sb.AppendLine('END:VCALENDAR')
}

Finally we can output the contents of the StringBuilder to an ICS file and then use that file to import into our preferred calendaring application.

# Output ICS File
$fileName = Read-Host -Prompt 'What should we call the ICS file? (end with .ics)'
$sb.ToString() | Out-File $fileName
Write-Host 'Operation complete! ICS file has been generated.'

Now you have a function that you can use to generate ICS files.  With some modifications you could adjust to use with other data sources and roll multiple events into a single ICS file.

Dell Storage Volume Cleanup with PowerShell

Posted 2 CommentsPosted in Compellent, Dell, PowerShell, Scripting, Tips and Tricks

If you’re new to PowerShell with Dell Storage, be sure to take a look at this post.  Depending upon the size of system that your managing, over the course of time, you might have experienced some challenges in managing disk resources, especially if you’re using an array in a lab-type environment.

Here’s an easy way to inventory volume objects on your SC Series array which are not currently mapped, and also find out how much actual space they’re consuming. (more…)

PowerShell Scripting Options for Dell Storage

Posted 2 CommentsPosted in Compellent, Dell, PowerShell, Scripting, Storage

Back in 2008, Compellent released their first iteration of the PowerShell Command Set.  They were the first storage vendor on the scene to provide PowerShell automation capabilities with the Series 40 array.

Fast forward a bunch of years.  The PowerShell Command Set has grown from 50 cmdlets to over 100, and added the capability to work with more advanced features like replication and Live Volume. (more…)

Do Your Exchange Online Admin Tasks with PowerShell

Posted Leave a commentPosted in Exchange, Office 365, PowerShell

There are some things in Exchange that you just need to use PowerShell for.  If you use Exchange Online or Office 365, the web portal exposes a lot of the admin functionality that you might need, but there are certain actions that require PowerShell.

Accessing the Exchange PowerShell cmdlets on a local server is one thing, but accessing those cmdlets in a hosted environment can be a little trickier.  After I had to type these a half-dozen times, my brain wasn’t getting it quite yet, so I build a little script that covers what you need to need to establish a connection to the remote Exchange environment.

(more…)