I'm trying to script a complete run which would include testing if various commands are already complete prior to running them again.
I can test for installation and importation of the code with
if (!(Get-Module "ACMESharp")) {
# module is not loaded
Install-Module -Name ACMESharp -AllowClobber -Scope CurrentUser
}
If (!(Get-module ACMESharp )) {
Import-Module ACMESharp
}
I can test for the presence of EFS with
$VaultOverride = ""
$x = ""
$efsTestFile = "$($env:ProgramData)\testing-efs.txt"
try
{
## If EFS isn't supported, it will fail with this call to Create
$x = [System.IO.File]::Create($efsTestFile, 100, "Encrypted")
$x.WriteByte(65)
$x.Close()
}
catch
{
"EFS not available."
$VaultOverride = "my-vault"
Set-ACMEVaultProfile -ProfileName my-vault -Provider local -VaultParameters @{ RootPath = "$env:LocalAppData\MyAcmeVault"; CreatePath = $true; BypassEFS = $true }
}
finally
{
del $efsTestFile
}
Totally a rookie newb here so please bear with me...
How can I test for whether or not the following commands have already been run?
Initialize-ACMEVault -VaultProfile $VaultOverride
New-ACMERegistration -VaultProfile $VaultOverride -Contacts mailto:me@mine.com -AcceptTos
Thanks.