576
General Software Discussion / Re: [Win][Suggestions needed] Ensure network shares are connected reliably at login?
« Last post by 4wd on January 06, 2019, 07:09 PM »Something like that:
Haven't tested it but the theory is sound
Code: PowerShell [Select]
- $w = $x = $y = $z = $true
- do {
- if (!(Test-Path W:\)) {
- Start-Process -FilePath "net.exe" -ArgumentList "use W: \\NAS\backups /PERSISTENT:YES" -Wait -WindowStyle Hidden
- } else {
- $w = $false
- }
- if (!(Test-Path X:\)) {
- Start-Process -FilePath "net.exe" -ArgumentList "use W: \\NAS\homes /PERSISTENT:YES" -Wait -WindowStyle Hidden
- } else {
- $x = $false
- }
- if (!(Test-Path Y:\)) {
- Start-Process -FilePath "net.exe" -ArgumentList "use W: \\NAS\media /PERSISTENT:YES" -Wait -WindowStyle Hidden
- } else {
- $y = $false
- }
- if (!(Test-Path Z:\)) {
- Start-Process -FilePath "net.exe" -ArgumentList "use W: \\NAS\temp /PERSISTENT:YES" -Wait -WindowStyle Hidden
- } else {
- $z = $false
- }
- } while ($w -or $x -or $y -or $z)
Haven't tested it but the theory is sound


Recent Posts
