BusyBox/MapBusyBox.ps1

21 lines
961 B
PowerShell

# Benutzername und Passwort
$User = "5ad15aa50bd186b488778908c92f099972aefa6831482bcca3560f26c6025383"
$Pass = "RJs6B-JAeRX-wQtiM-Xi4c6-cYBD4"
# Passwort in SecureString umwandeln
$SecurePass = ConvertTo-SecureString $Pass -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential($User, $SecurePass)
# Laufwerk X: entfernen, falls vorhanden
if (Get-PSDrive -Name X -ErrorAction SilentlyContinue) {
Remove-PSDrive -Name X -Force
}
# 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
$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