From 7825b3f27df1f298b6b12ce4c7d128901aed499a Mon Sep 17 00:00:00 2001 From: Marc Blatter Date: Mon, 27 Oct 2025 10:44:00 +0000 Subject: [PATCH] Korrektur --- MapBusyBox.ps1 | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/MapBusyBox.ps1 b/MapBusyBox.ps1 index ff6d031..24aa332 100644 --- a/MapBusyBox.ps1 +++ b/MapBusyBox.ps1 @@ -1,21 +1,24 @@ # Benutzername und Passwort -$User = "5ad15aa50bd186b488778908c92f09972aefa683148" -$Pass = "DeinPasswort" +$User = "5ad15aa50bd186b488778908c92f099972aefa6831482bcca3560f26c6025383" +$Pass = "RJs6B-JAeRX-wQtiM-Xi4c6-cYBD4" # Passwort in SecureString umwandeln $SecurePass = ConvertTo-SecureString $Pass -AsPlainText -Force - -# Credentials erstellen $Cred = New-Object System.Management.Automation.PSCredential($User, $SecurePass) -# Prüfen, ob das Laufwerk bereits existiert und ggf. entfernen +# Prüfen, ob das Laufwerk bereits existiert if (Get-PSDrive -Name X -ErrorAction SilentlyContinue) { Remove-PSDrive -Name X -Force } -# Netzlaufwerk mappen mit persistenter Verbindung -New-PSDrive -Name X -PSProvider FileSystem -Root "\\cloud.busybox.ch\Pfad" -Credential $Cred -Persist +# Netzlaufwerk mappen (persistent) über UNC-Pfad für WebDAV +$UNCPath = "\\cloud.busybox.ch\remote.php\dav\files\$User" +New-PSDrive -Name X -PSProvider FileSystem -Root $UNCPath -Credential $Cred -Persist -# Optional: Laufwerksbezeichnung ändern (im Explorer sichtbar) -$Net = New-Object -ComObject WScript.Network -$Net.MapNetworkDrive("X:", "\\cloud.busybox.ch\Pfad", $true, $User, $Pass) \ No newline at end of file +# Explorer-Laufwerksbezeichnung setzen (Anzeige im Windows Explorer) +# Pfad für MountPoints2 muss genau der UNC-Notation entsprechen +$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 +} +New-ItemProperty -Path $RegPath -Name "_LabelFromReg" -Value "BusyBox" -Force | Out-Null \ No newline at end of file