-
Notifications
You must be signed in to change notification settings - Fork 0
/
PSGestioIP.psm1
29 lines (24 loc) · 1.04 KB
/
PSGestioIP.psm1
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
$Script:ModuleRoot = $PSScriptRoot
$Script:CredentialFile = "$env:TEMP\63571053cr37.xml"
$Script:HostCategoryFile = "$env:TEMP\GestioHostCategories.txt"
$Script:NetworkCategoryFile = "$env:TEMP\GestioNetworkCategories.txt"
$Script:SiteFile = "$env:TEMP\GestioSites.txt"
$Private = @(Get-ChildItem -Path $ModuleRoot\Private\*.ps1 -ErrorAction SilentlyContinue)
$Public = @(Get-ChildItem -Path $ModuleRoot\Public\*.ps1 -ErrorAction SilentlyContinue)
foreach ($Import in @($Private + $Public)) {
try {
. $Import.FullName
}
catch {
Write-Error -Message "Failed to import function $($Import.FullName): $_"
}
}
Export-ModuleMember -Function $Public.Basename
Export-ModuleMember -Variable ModuleRoot, HostCategoryFile, NetworkCategoryFile, SiteFile
if (-not (Test-Path $CredentialFile)) {
Clear-Host
Save-GestioCredential -User 'gipadmin'
}
if ($false -in (Test-Path $HostCategoryFile, $NetworkCategoryFile, $SiteFile)) {
Get-GestioCategory -Type HostCategories, NetworkCategories, Sites
}