-
-
Notifications
You must be signed in to change notification settings - Fork 278
Expand file tree
/
Copy pathDebug.ps1
More file actions
52 lines (43 loc) · 1.8 KB
/
Debug.ps1
File metadata and controls
52 lines (43 loc) · 1.8 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<#
.SYNOPSIS
Debugging script for the DSInternals PowerShell module.
.PARAMETER ModulePath
Path to the compiled PowerShell module
#>
#Requires -Version 5.1
[CmdletBinding(DefaultParameterSetName = 'Configuration')]
param(
[Parameter(Mandatory = $false, ParameterSetName = 'ModulePath')]
[ValidateNotNullOrEmpty()]
[string] $ModulePath,
[Parameter(Mandatory = $false, ParameterSetName = 'Configuration')]
[ValidateNotNullOrEmpty()]
[ValidateSet('Debug', 'Release')]
[string] $Configuration = 'Debug'
)
if ([string]::IsNullOrWhiteSpace($ModulePath)) {
# No path has been provided, so use a the default value
$ModulePath = Join-Path -Path $PSScriptRoot -ChildPath "..\..\Build\bin\DSInternals.PowerShell\$Configuration\DSInternals" -Resolve -ErrorAction Stop
} else {
[bool] $isFile = Test-Path -Path $ModulePath -PathType Leaf -ErrorAction SilentlyContinue
if ($isFile) {
# This is probably the module manifest path
# Get the path to the module directory, without the trailing slash
$ModulePath = Split-Path -Path $ModulePath -Parent -Resolve -ErrorAction Stop
} else {
# Translate possibly relative module directory path to an absolute one
$ModulePath = Resolve-Path -Path $ModulePath -ErrorAction Stop
}
}
# Clean the prompt
function prompt() { 'PS> ' }
# Load the compiled module
Import-Module -Name $ModulePath -Force -Verbose -ErrorAction Stop
# Set directory paths
[string] $solutionDirectory = Split-Path -Path $PSScriptRoot -Parent
[string] $repoRootDirectory = Split-Path -Path $solutionDirectory -Parent
[string] $testDataDirectory = Join-Path -Path $repoRootDirectory -ChildPath 'TestData'
# Run test commands
Get-BootKey -Online
$password = ConvertTo-SecureString 'Pa$$w0rd' -AsPlainText -Force
ConvertTo-NTHash $password