2020-05-22 03:52:48 -04:00
|
|
|
<#
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Unblocks a folder with PowerShell module/script files to make them usable
|
|
|
|
|
on certain environments
|
|
|
|
|
.DESCRIPTION
|
|
|
|
|
Wrapper command to unblock recursively a certain folder for PowerShell script
|
|
|
|
|
and module files
|
|
|
|
|
.FUNCTIONALITY
|
|
|
|
|
Unblocks a folder with PowerShell module/script files to make them usable
|
|
|
|
|
on certain environments
|
|
|
|
|
.EXAMPLE
|
|
|
|
|
PS>Unblock-IcingaPowerShellFiles -Path 'C:\Program Files\WindowsPowerShell\Modules\my-module';
|
|
|
|
|
.PARAMETER Path
|
|
|
|
|
The path to a PowerShell module folder or script file to unblock it
|
|
|
|
|
.INPUTS
|
|
|
|
|
System.String
|
|
|
|
|
.OUTPUTS
|
|
|
|
|
Null
|
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/Icinga/icinga-powershell-framework
|
|
|
|
|
#>
|
|
|
|
|
|
2019-11-03 09:55:08 -05:00
|
|
|
function Unblock-IcingaPowerShellFiles()
|
|
|
|
|
{
|
|
|
|
|
param(
|
|
|
|
|
$Path
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if ([string]::IsNullOrEmpty($Path)) {
|
2020-05-13 10:53:15 -04:00
|
|
|
Write-IcingaConsoleError 'The specified directory was not found';
|
2019-11-03 09:55:08 -05:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-13 10:53:15 -04:00
|
|
|
Write-IcingaConsoleNotice 'Unblocking Icinga PowerShell Files';
|
2019-11-03 09:55:08 -05:00
|
|
|
Get-ChildItem -Path $Path -Recurse | Unblock-File;
|
|
|
|
|
}
|