PowerShell 3.0 and later To store secret information, you can use a SecureString object and save it to disk. PowerShell automatically takes the user...
database-tools
Tinker, Tailor, Developer, DBA
Tinker, Tailor, Developer, DBA is not intended as a pitch on a slightly less harrowing book or movie than the John Le Carre classic. ...
Finding Exchange Mailboxes
Microsoft Exchange 2013 To find the number of mailboxes, simply use the Exchange cmdlets and have Measure-Object count the results: Get-Mailbox...
Clever Parameter Validation
PowerShell 2.0 and later When you create PowerShell functions with parameters, make sure you tell PowerShell what kind of values the parameter...
Discovering High Impact Cmdlets
All Versions Cmdlets can declare how severe their impact is. Typically, cmdlets that make changes to the system that cannot be undone will have an...
ISE Auto-Completion Trick
PowerShell 3.0 ISE and later When you want to select the information returned by a cmdlet, you typically use Select-Object: Get-Process |...
Backup and Restore of Windows Azure SQL Databases
A growing number of companies have already moved some level of applications and data to the cloud. An equally growing number of companies are still...
Accessing Non-Microsoft LDAP Servers
All Versions There are free Active Directory cmdlets from Microsoft (part of the RSAT tools) and Dell (Quest). They take the complexity out of...
Finding Read-Only and Constant Variables
All PowerShell versions Some variables are protected and cannot be changed. To identify these, take a look at this line: Get-Variable | Where-Object...
Read-Only and Strongly Typed Variables
All PowerShell versions To make PowerShell scripts more robust, you can code a lot of requirements right into your script variables. When you do...
Your new job as a DBA
Are you a database administrator who just started a new job? Have you just taken administrator responsibilities for a new business unit’s databases?...
Using Constants
All PowerShell versions Variables in PowerShell are volatile. You can overwrite and delete them – unless you create constants. Constants can...
Including Resources with Your Scripts
PowerShell 3.0 and later If your script needs additional resources, like text lists of server names, or picture files, or anything else, then make...
Becoming a Top DBA – Learning Automation in SQL Server
Joseph D'Antoni, Microsoft MVP provides insight and examples from his experience as a consultant. The value you truly bring to your...
Using “more” in the PowerShell ISE
PowerShell ISE In the PowerShell console, you can pipe commands to the old-fashioned “more.com”, or better yet, to Out-Host...
Read User Profiles from Registry
All versions To find out which users have a (local) user profile on your machine, and where this profile is located, try this snippet: $path =...
Reading Associated File Extensions from Registry (Part 2)
All versions In a previous tip you learned how a one-liner can read multiple registry keys. In part 2, check out this one-liner: $lookup =...
ER/Studio MetaWizard Does The Magic!
Often times you would hear about moving objects from one Data Modeling platform to another for various reasons. Embarcadero's Meta-Wizard...
Reading Associated File Extensions from Registry
All versions PowerShell code can be extremely dense. Here is a one-liner that reads all associated file extensions from the Windows Registry:...
Sort Things with Type
All Versions Sort-Object is your one-stop solution for sorting. If it’s primitive data, simply pipe it to Sort-Object. If it is object data,...
Agent vs. Agentless Monitoring
With a unified IT monitoring solution like up.time one of the more popular discusses we have with users is agent versus agentless monitoring. In...
Opening Webpages from PowerShell
All versions Let’s assume you would like to open your favorite websites in a browser when you start your day. PowerShell can do this for you...
Service Broker Gone Wild: Dealing With sysxmitqueue Bloat
Have you ever been surprised by suddenly finding out that one of your databases has grown way beyond your expectations? Hopefully, this isn’t...
Measuring Website Response (and Execution Times)
PowerShell 3.0 and later Sometimes it is important to know just how long a command takes. For example, to monitor web site response times, you could...