Unauthorised Guest Login, Autodisconnect

Unauthorised Guest Login, Autodisconnect

To allow sharing – mapping network

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\AllowInsecureGuestAuth -> set to 1

To disable autoconnect – mapping network

  1. run cmd as administrator
  2. type – net service server /autodisconnect:-1 (-1 means disable)
  3. else set to minutes – net service server /autodisconnect: timeout minutes

or set in regedit Lanman -> parameters to ffffffff (8 f’s)

To force connect network mapping

-> refer: http://woshub.com/could-not-reconnect-mapped-network-drives/

-> refer: https://docs.microsoft.com/en-us/troubleshoot/windows-client/networking/mapped-network-drive-fail-reconnect

PowerShell -Command "Set-ExecutionPolicy -Scope CurrentUser Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1
PowerShell -File "%SystemDrive%\Scripts\MapDrives.ps1" >> "%TEMP%\StartupLog.txt" 2>&1
$i=3
while($True){
    $error.clear()
    $MappedDrives = Get-SmbMapping |where -property Status -Value Unavailable -EQ | select LocalPath,RemotePath
    foreach( $MappedDrive in $MappedDrives)
    {
        try {
            New-SmbMapping -LocalPath $MappedDrive.LocalPath -RemotePath $MappedDrive.RemotePath -Persistent $True
        } catch {
            Write-Host "There was an error mapping $MappedDrive.RemotePath to $MappedDrive.LocalPath"
        }
    }
    $i = $i - 1
    if($error.Count -eq 0 -Or $i -eq 0) {break}

    Start-Sleep -Seconds 30
}
  1. Copy the script file (MapDrives.cmd) to the following location:
    %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp
  2. Copy the script file (MapDrives.ps1) to the following location:
    %SystemDrive%\Scripts\ (Create a C:\Scripts folder)
  3. A log file (StartupLog.txt) will be created in the %TEMP%\ folder.
  4. Log off, and then log back on to the device to open the mapped drives.