Untitled

 avatar
unknown
plain_text
2 months ago
680 B
6
Indexable
$MacIP  = "192.168.0.238"
$Share  = "COD5"
$Drive  = "Z:"

# wyczyść stare połączenia/poświadczenia
cmd /c "net use * /delete /y" | Out-Null
cmdkey /delete:$MacIP 2>$null | Out-Null

# włącz guest SMB (bez loginu/hasła)
try {
    Set-SmbClientConfiguration -EnableInsecureGuestLogons $true -Force | Out-Null
} catch {
    New-ItemProperty `
      -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" `
      -Name "AllowInsecureGuestAuth" `
      -PropertyType DWord `
      -Value 1 `
      -Force | Out-Null
}

Restart-Service LanmanWorkstation -Force

# mapowanie udziału
cmd /c "net use $Drive \\$MacIP\$Share /user:Guest \"\" /persistent:yes"
Editor is loading...
Leave a Comment