-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLabilityBootstrap.psm1
31 lines (26 loc) · 1.27 KB
/
LabilityBootstrap.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Requires -RunAsAdministrator
## Import localisation strings
Import-LocalizedData -BindingVariable localized -FileName Resources.psd1 -BaseDirectory $PSScriptRoot;
$lability = Get-Module -Name 'Lability';
$defaults = @{
ModuleRoot = Split-Path -Path $MyInvocation.MyCommand.Path -Parent;
ModulesPath = 'Modules';
ResourcesPath = 'Resources';
ConfigurationsPath = 'Configurations';
CertificatesPath = 'Certificates';
}
## Import the \Lib files. This permits loading of the module's functions for unit testing, without having to unload/load the module.
$moduleRoot = Split-Path -Path $MyInvocation.MyCommand.Path -Parent;
$moduleSrcPath = Join-Path -Path $moduleRoot -ChildPath 'Src';
Get-ChildItem -Path $moduleSrcPath -Include *.ps1 -Exclude 'Bootstrap.ps1' -Recurse |
ForEach-Object {
Write-Verbose -Message ('Importing library\source file ''{0}''.' -f $_.FullName);
. $_.FullName;
}
## Create the credential check scriptblock
$credentialCheckScriptBlock = {
## Only prompt if -Password is not specified. This works around the credential pop-up regardless of the ParameterSet!
if ($PSCmdlet.ParameterSetName -eq 'PSCredential') {
Get-Credential -Message $localized.EnterLocalAdministratorPassword -UserName 'LocalAdministrator';
}
}