HPWriteManager.psm1

<#
  File: HPWriteManager.psm1
  Author: Casper Stekelenburg
  Copyright: � 2019 Casper Stekelenburg. All rights reserved.
  Notes: The software is provided "as is", without warranty of any kind, express or implied, including
                but not limited to the warranties of merchantability, fitness for a particular purpose and
                noninfringement. In no event shall the authors or copyright holders be liable for any claim,
                damages or other liability, whether in an action of contract, tort or otherwise, arising from,
                out of or in connection with the software or the use or other dealings in the software.
#>

#Set-StrictMode -Version 2

If ($null -eq $HpWF) {
    Throw "Unable to load module, HPWriteFConfig class not found. Please make sure the HP Write Manager software installed."
}

# Functions in this module:
#Get public and private function definition files.
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue )
$Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue )

#Dot source the files
Foreach ($import in @($Public + $Private)) {
    Try {
        . $import.fullname
    } Catch {
        Write-Error -Message "Failed to import function $($import.fullname): $_"
    }
}

<#
    Here I might...
        Read in or create an initial config file and variable
        Export Public functions ($Public.BaseName) for WIP modules
        Set variables visible to the module and its functions only
#>


#region Variables
$Script:HPWFNameSpace = "root\hp\writefilters"
$Script:HpWF = Get-WmiObject -Namespace $Script:HPWFNameSpace -Class HpWriteFConfig -ErrorAction SilentlyContinue
$Script:HPRF = Get-WmiObject -Namespace $Script:HPWFNameSpace -Class HpRegFConfig -ErrorAction SilentlyContinue
$Script:HPRFEE = Get-WmiObject -Namespace $Script:HPWFNameSpace -Class HpRegFExclusionEntry -ErrorAction SilentlyContinue
$Script:HPDC = Get-WmiObject -Namespace $Script:HPWFNameSpace -Class HpCacheDiskConfig -ErrorAction SilentlyContinue
$Script:HPDCI = Get-WmiObject -Namespace $Script:HPWFNameSpace -Class HpCacheDiskInfo -ErrorAction SilentlyContinue
$Script:HPCSS = Get-WmiObject -Namespace $Script:HPWFNameSpace -Class HpCacheSystemStatistics -ErrorAction SilentlyContinue
$Script:HPPVI = Get-WmiObject -namespace $Script:HPWFNameSpace -Class HpWriteFProtectedVolumeInfo -ErrorAction SilentlyContinue
#endregion Variables

Export-ModuleMember -Function $Public.Basename