diff --git a/MapBusyBox.ps1 b/MapBusyBox.ps1 index 24aa332..54d4ce4 100644 --- a/MapBusyBox.ps1 +++ b/MapBusyBox.ps1 @@ -6,19 +6,16 @@ $Pass = "RJs6B-JAeRX-wQtiM-Xi4c6-cYBD4" $SecurePass = ConvertTo-SecureString $Pass -AsPlainText -Force $Cred = New-Object System.Management.Automation.PSCredential($User, $SecurePass) -# Prüfen, ob das Laufwerk bereits existiert +# Laufwerk X: entfernen, falls vorhanden if (Get-PSDrive -Name X -ErrorAction SilentlyContinue) { Remove-PSDrive -Name X -Force } -# Netzlaufwerk mappen (persistent) über UNC-Pfad für WebDAV +# Netzlaufwerk mappen $UNCPath = "\\cloud.busybox.ch\remote.php\dav\files\$User" New-PSDrive -Name X -PSProvider FileSystem -Root $UNCPath -Credential $Cred -Persist -# Explorer-Laufwerksbezeichnung setzen (Anzeige im Windows Explorer) -# Pfad für MountPoints2 muss genau der UNC-Notation entsprechen +# Explorer-Laufwerksbezeichnung setzen $RegPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##cloud.busybox.ch#remote.php#dav#files#$User" -if (-not (Test-Path $RegPath)) { - New-Item -Path $RegPath -Force | Out-Null -} +if (-not (Test-Path $RegPath)) { New-Item -Path $RegPath -Force | Out-Null } New-ItemProperty -Path $RegPath -Name "_LabelFromReg" -Value "BusyBox" -Force | Out-Null \ No newline at end of file