Earlier this month I posted a Powershell function to check for a loaded module.
Bas Steeloper, another Dutch IT Pro, commented on the post and by tweaking the function I’ve provided in the post he came up with a another function to check for a loaded snapin.
You can find his comment here but for your convenience here is the code:
1 2 3 4 5 6 7 |
function Check-LoadedSnapIN{ Param( [parameter(Mandatory = $true)][alias("SnapIN")][string]$SnapINName) if ( (Get-PSSnapin -Name $SnapINName -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin $SnapINName } } |