PowerShell/test/powershell/Provider/AutomountSubstDrive.ps1
Steve Lee 2639cd89ce Autocorrected CRLF to LF (#4943)
Also, fix `Parser.Tests.ps1` after correcting CRLF.
2017-09-29 16:28:15 -07:00

39 lines
732 B
PowerShell

# Precondition: start from fresh PS session, do not have the media mounted
param([switch]$useModule, [string]$FullPath)
$global:CoreScriptPath = Join-Path $PSScriptRoot 'AutomountSubstDriveCore.ps1'
if ($useModule)
{
$m = New-Module {
function Test-DrivePresenceFromModule
{
param ([String]$Path)
& $global:CoreScriptPath -Path $Path
}
Export-ModuleMember -Function Test-DrivePresenceFromModule
}
}
try
{
if ($useModule)
{
Import-Module $m -Force
Test-DrivePresenceFromModule -Path $FullPath
}
else
{
& $global:CoreScriptPath -Path $FullPath
}
}
finally
{
if ($useModule)
{
Remove-Module $m
}
}