forked from JeffHarkavy/SafeguardCmdletTesting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmdlet-tests-obsolete-commands.ps1
84 lines (62 loc) · 2.93 KB
/
cmdlet-tests-obsolete-commands.ps1
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
try {
Get-Command "writeCallHeader" -ErrorAction Stop > $null
} catch {
write-host "Not meant to be run as a standalone script" -ForegroundColor Red
exit
}
$TestBlockName = "Running Obsolete Commands"
$blockInfo = testBlockHeader $TestBlockName
# ===== Covered Commands =====
# Add-SafeguardSessionSshAlgorithm
# Get-SafeguardSessionCertificate
# Get-SafeguardSessionContainerStatus
# Get-SafeguardSessionModuleStatus
# Get-SafeguardSessionModuleVersion
# Get-SafeguardSessionSshAlgorithms
# Invoke-SafeguardSessionsPing
# Invoke-SafeguardSessionsTelnet
# Remove-SafeguardSessionSshAlgorithm
# Reset-SafeguardSessionModule
# Set-SafeguardSessionSshAlgorithms
# Repair-SafeguardSessionModule
# New-SafeguardStarling2faAuthentication
function testObsolete($cmd, $extraArgs1) {
$cmd = "$cmd $(iif $extraArgs1 $extraArgs1 '') -ErrorAction:SilentlyContinue -WarningAction:Continue"
writeCallHeader "$cmd OBSOLETE"
try { Invoke-Expression $cmd }
catch {
if ($_.Exception.ErrorCode -ne 60385) {
if ($_.Exception.Message -Match 'is not recognized as the name of a cmdlet, function, script file, or operable program'){
goodResult "$cmd" "Success"
}
else{
badResult "$cmd" "Unexpected error" $_
}
}
else { goodResult "$cmd" "Success" }
}
}
# All of the following commands are *expected* to be obsolete and should only spit out
# a Warning (or 2) about that. If any other error comes out we'll squawk
testObsolete "Add-SafeguardSessionSshAlgorithm" "ServerSide Cipher 3des-cbc"
testObsolete "Get-SafeguardSessionCertificate" "-Type TimeStamping"
testObsolete "Get-SafeguardSessionContainerStatus"
testObsolete "Get-SafeguardSessionModuleStatus"
testObsolete "Get-SafeguardSessionModuleVersion"
testObsolete "Get-SafeguardSessionSshAlgorithms"
testObsolete "Get-SafeguardSessionContainerStatus"
testObsolete "Invoke-SafeguardSessionsPing" "-NetworkAddress 10.9.6.79"
testObsolete "Invoke-SafeguardSessionsTelnet" "-NetworkAddress 10.9.6.79 -Port 22"
testObsolete "Set-SafeguardSessionSshAlgorithms" "ServerSide Cipher"
testObsolete "Remove-SafeguardSessionSshAlgorithm" "ServerSide Cipher 3des-cbc"
testObsolete "Reset-SafeguardSessionModule"
testObsolete "Repair-SafeguardSessionModule"
testObsolete "New-SafeguardStarling2faAuthentication"
testObsolete "Get-SafeguardAccessCertificationAccount"
testObsolete "Get-SafeguardAccessCertificationAccount -Identifier $DATA.appliance -StdOut"
testObsolete "Get-SafeguardAccessCertificationAll -Identifier $DATA.appliance -OutputDirectory $DATA.outputPaths.certificates -DomainName $DATA.domainName -Credential $DATA.domainCredential"
testObsolete "Get-ADAccessCertificationIdentity"
testObsolete "Get-SafeguardAccessCertificationGroup"
testObsolete "Get-SafeguardAccessCertificationIdentity"
testObsolete "Get-SafeguardAccessCertificationEntitlement"
testBlockHeader $TestBlockName $blockInfo