SysAdminsFriends.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
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
<#
.SYNOPSIS
The module SysAdminsFriends provides some tools that are useful for system administrators.
.NOTES
Version: 1.1.3
Date: 2020-08-22
Author: Markus Scholtes
#>


# check for integrity of the source files
if (!(Test-Path "$PSScriptRoot/functions.cat"))
{
    Write-Error "Cannot load module because files are missing"
    exit
}
if (Get-Command Test-FileCatalog -EA SilentlyContinue)
{ # available only from Powershell 5.1 on
    if ((Test-FileCatalog -Path "$PSScriptRoot/functions" -Detailed -CatalogFilePath "$PSScriptRoot/functions.cat").Status -ne "Valid")
    { # cancel because files have been changed
        Write-Error "Cannot load module because files have been modified"
        exit
    }
}

# Load modules manually for security reasons
. "$PSScriptRoot/functions/Compress-LogDirectory.ps1"
. "$PSScriptRoot/functions/ConvertTo-Batch.ps1"
. "$PSScriptRoot/functions/Export-FirewallRules.ps1"
. "$PSScriptRoot/functions/Get-RebootTime.ps1"
. "$PSScriptRoot/functions/Get-Sessions.ps1"
. "$PSScriptRoot/functions/Import-FirewallRules.ps1"
. "$PSScriptRoot/functions/Invoke-AdminExplorer.ps1"
. "$PSScriptRoot/functions/Remove-FirewallRules.ps1"
. "$PSScriptRoot/functions/Replace-InFile.ps1"
. "$PSScriptRoot/functions/Split-File.ps1"
. "$PSScriptRoot/functions/Export-FileSegment.ps1"
. "$PSScriptRoot/functions/Import-FileSegment.ps1"
. "$PSScriptRoot/functions/Start-WebServer.ps1"

# Export functions
Export-ModuleMember -Function @(
    'Compress-LogDirectory',
    'ConvertTo-Batch',
    'Export-FirewallRules',
    'Import-FirewallRules',
    'Remove-FirewallRules',
    'Get-RebootTime',
    'Get-Sessions',
    'Replace-InFile',
    'Split-File',
    'Join-File',
    'Export-FileSegment',
    'Import-FileSegment',
    'Invoke-AdminExplorer',
    'Test-Admin',
    'Select-FileDialog',
    'Start-Webserver'
)