Tags » PowerShell

Simple PowerShell Function for Array

Trying to simplify some scripts, I wanted to a reusable function I could just call. I would pass an array to the function to have it process the input and spit out the info I want. 35 more words


PowerShell Parameter Validation

It’s possible to validate input in PowerShell!

There are eight built in functions:

  1. ValidateNotNull
  2. ValidateNotNullOrEmpty
  3. ValidateLength
  4. ValidateCount
  5. ValidateRange
  6. ValidateSet
  7. ValidatePattern
  8. ValidateScript

With dynamic typing,  I don’t see the importance of one through seven, but eight!   32 more words

Get User Profile Sync Connection Information

Have you ever inherited a SharePoint 2010 Farm and needed to rebuild the User Profile Service? No? Consider yourself lucky. If you have then you have undoubtedly ran into the problem of needing the AD Sync information to get profiles from the proper OU, CN etc. 500 more words


Remove Database User & Login via powershell

Kind of a re-post of an older post of mine. This one doesn’t use SQLPS though and it also drops the login from the server as well. 58 more words

SQL Server

PowerShell : Record Process Time Script (Updated)

I’ve had the script I wrote to keep a record of certain processes run time running for  a while (I’m using it to keep a log of the games I play and when).  445 more words


Quick tip: Dynamically create and use variables

Creating and using variables in PowerShell is simple. Unlike most other languages you don’t need to initialize a variable before use – you don’t even need to type them; PowerShell will attempt to set the type based on the value you give it. 360 more words