Version 1.0.1
This commit is contained in:
@@ -63,6 +63,52 @@ function Test-RepositoryPath {
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
# Resolve-RepositoryPath
|
||||
############################################################
|
||||
|
||||
function Resolve-RepositoryPath {
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Path,
|
||||
[AllowEmptyString()][string]$InstallationSource
|
||||
)
|
||||
|
||||
if($Path -ne "Auto") {
|
||||
$Root = [IO.Path]::GetPathRoot($Path)
|
||||
if($env:OS -eq "Windows_NT" -and ![string]::IsNullOrWhiteSpace($Root)) {
|
||||
$DriveId = $Root.TrimEnd('\')
|
||||
$Drive = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID = '$DriveId'" -ErrorAction SilentlyContinue
|
||||
if($null -ne $Drive -and $Drive.DriveType -ne 3) {
|
||||
throw "Repository-Pfad liegt nicht auf einer lokalen Festplatte: $Path"
|
||||
}
|
||||
}
|
||||
|
||||
return $Path
|
||||
}
|
||||
|
||||
if($env:OS -ne "Windows_NT") {
|
||||
throw "Automatische Repository-Laufwerkswahl wird nur unter Windows unterstützt."
|
||||
}
|
||||
|
||||
$SourceRoot = [IO.Path]::GetPathRoot($InstallationSource)
|
||||
$FixedDrives = @(
|
||||
Get-CimInstance Win32_LogicalDisk -Filter "DriveType = 3" -ErrorAction Stop |
|
||||
Where-Object {
|
||||
[string]::IsNullOrWhiteSpace($SourceRoot) -or
|
||||
$_.DeviceID -ne $SourceRoot.TrimEnd('\')
|
||||
} |
|
||||
Sort-Object FreeSpace -Descending
|
||||
)
|
||||
|
||||
if($FixedDrives.Count -eq 0) {
|
||||
throw "Keine lokale Festplatte für das Veeam-Repository gefunden."
|
||||
}
|
||||
|
||||
return (Join-Path ("{0}\" -f $FixedDrives[0].DeviceID) "VeeamRepository")
|
||||
}
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
# New-RepositoryFolder
|
||||
|
||||
@@ -1371,6 +1417,7 @@ function Get-RepositoryModuleInformation {
|
||||
Export-ModuleMember `
|
||||
-Function `
|
||||
Test-RepositoryPath,
|
||||
Resolve-RepositoryPath,
|
||||
New-RepositoryFolder,
|
||||
Get-RepositoryInformation,
|
||||
Test-RepositoryFreeSpace,
|
||||
|
||||
Reference in New Issue
Block a user