Search

  • $PSCmdletBinding.ShouldProcess...

    Hi, I use if $PSCmdletBinding.ShouldProcess(...)) { } in quite a few of my scripts, but what I wanted to know was is there any way to prevent the script from terminating when the user presses Suspend? The reason I ask is because I create some New-Objects that I'd like to clean up.
    Posted to PowerShell for Windows (Forum) by Des on 03-01-2012
  • Re: Using optional parameters and parameter sets

    Thanks for that; I tried your suggestion and it works like a charm, although I left the switch statement as it was.
    Posted to PowerShell for SharePoint (Forum) by Des on 02-21-2012
  • Using optional parameters and parameter sets

    I needed to define a PowerShell cmdlet function that optionally accepted different typed parameters; Parameter Sets seemed to be the ideal thing for this, but I struggled to find anything describing how to deal with no parameters. I ended up with the following; function global : Get - SPQuotaTemplate { [ CmdletBinding ( DefaultParameterSetName = "none" )] param ( [ Parameter ( ParameterSetName = "name" , Position = 0 , ValueFromPipeline = $true )] [ string ] $name , [ Parameter
    Posted to PowerShell for SharePoint (Forum) by Des on 01-31-2012
    Filed under: Quota Templates, Parameter Sets
Page 1 of 1 (3 items) | RSS | More Search Options
Copyright 2012 PowerShell.com. All rights reserved.