-
Notifications
You must be signed in to change notification settings - Fork 234
Expand file tree
/
Copy pathClear-ModuleVariable.ps1
More file actions
25 lines (21 loc) · 959 Bytes
/
Clear-ModuleVariable.ps1
File metadata and controls
25 lines (21 loc) · 959 Bytes
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
<#
.SYNOPSIS
Resets all module variables to their default values.
.DESCRIPTION
Variables like $MtGraphCache and $MtGraphBaseUri are module-level variables that are cached
during the running of a test for performance reasons.
This function will be called for each fresh run of Invoke-Maester.
#>
function Clear-ModuleVariable {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification='Module variables used in other functions.')]
param()
Clear-MtGraphCache
$__MtSession.GraphBaseUri = $null
$__MtSession.TestResultDetail = @{}
$__MtSession.MaesterConfig = $null
$__MtSession.AdminPortalUrl = @{}
Clear-MtDnsCache
Clear-MtExoCache
Clear-MtSpoCache
# $__MtSession.Connections = @() # Do not clear connections as they are used to track the connection state. This module variable should only be set by Connect-Maester and Disconnect-Maester.
}