Private/AllFunctions.ps1
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 |
function Get-PathOSDD { [CmdletBinding()] Param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [string]$Path ) if (-not(Test-Path "$Path")) { try {New-Item -Path "$Path" -ItemType Directory -Force -ErrorAction Stop | Out-Null} catch {Write-Error "Could not create the OSDDrivers Directory at $Path" -ErrorAction Stop} } try {Get-Item -Path "$Path" -ErrorAction Stop | Out-Null} catch {Write-Error "Could not get the OSDDrivers Directory at $Path" -ErrorAction Stop} $PathOSDD = (Get-Item "$Path").FullName Return $PathOSDD } function Get-DirectoryName { [CmdletBinding()] Param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [string]$DriverPath ) $DirectoryName = (Get-Item "$DriverPath").Name Return $DirectoryName } function Get-ParentDirectoryFullName { [CmdletBinding()] Param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [string]$DriverPath ) $ParentDirectoryFullName = (Get-Item "$DriverPath").parent.FullName Return $ParentDirectoryFullName } function Test-DriverPath { [CmdletBinding()] Param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [string]$DriverPath ) try {Get-Item -Path $DriverPath -ErrorAction Stop | Out-Null} catch {Write-Error "Could not find the DriverPath at $DriverPath" -ErrorAction Stop} } function Test-ExpandedDriverPath { [CmdletBinding()] Param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [string]$ExpandedDriverPath ) try {Get-Item -Path $ExpandedDriverPath -ErrorAction Stop | Out-Null} catch {Write-Error "Could not find the ExpandedDriverPath at $ExpandedDriverPath" -ErrorAction Stop} } |