Inhaltsverzeichnis

Grundgerüst Powershellfunktion

Typischer Aufbau eines Powershell-Cmdlets

function Test-Blubb
{
  [CmdletBinding()]
  param
  (
    #Insert Parameter-Definition here
  )
  begin
  {
    #Insert actions here for initial setup of Cmdlet
  }
  process
  {
    #Insert here the recurring part for all transmitted objects
  }
  end
  {
    #Insert here final actions, like closing connections, dispose objects, etc...
  }
}

CmdletBinding()

Quelle: Link

Param-Block

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-5.1

1)
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact=Medium)]
2)
Im Script muss die Abfrage mit Hilfe von $pscmdlet.ShouldProcess() implementiert werden