6 lines
1.0 KiB
PowerShell
6 lines
1.0 KiB
PowerShell
#Requires -Version 5.1
|
|
[CmdletBinding(SupportsShouldProcess)]param([ValidateSet('Install','Remove','Test')][string]$Mode='Install',[string[]]$VeraCryptVolume=@(),[string]$VeraCryptPath)
|
|
Set-StrictMode -Version Latest;$ErrorActionPreference='Stop';Import-Module (Join-Path $PSScriptRoot 'src/Wind.Core.psm1');Import-Module (Join-Path $PSScriptRoot 'src/Wind.Lock.psm1')
|
|
if($Mode-eq'Test'){$root=Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'MsPrivate\lock';[IO.Directory]::CreateDirectory($root)|Out-Null;Invoke-WindLockEvent -VeraCryptVolume $VeraCryptVolume -VeraCryptPath $VeraCryptPath -ReportPath (Join-Path $root 'manual-test.json')|Format-List;return}
|
|
Assert-WindMutationAllowed;if($Mode-eq'Install'){if($PSCmdlet.ShouldProcess('Task Scheduler','Install session-lock privacy handler')){Install-WindLockHandler -VeraCryptVolume $VeraCryptVolume -VeraCryptPath $VeraCryptPath -SourceRoot $PSScriptRoot}}else{if($PSCmdlet.ShouldProcess('Task Scheduler','Remove session-lock privacy handler')){Remove-WindLockHandler}}
|