Recommended Posts

Hi,

We run VB scripts to map network drives at user logon. However, when laptop users go home for the day and logon at home away from the network, these scripts still run and errors pop up from the VB script since the path cannot be found.

Is there a nice way to handle this? Perhaps detect that they are offline and don't bother running the script? Or gracefully dying and telling the user that they're offline so it cannot be mapped? Or ...

Thanks for any advice :)

Link to comment
https://www.neowin.net/forum/topic/451127-mapping-network-drives-while-offline/
Share on other sites

Yes there is ...what I do is I use wmi to get the ssidname of the network. If its true then it will map the drives.

Unfortunaley I don't do vbscript because vbscript is crap. I use monad (MSH) do all my scripts.

I also use net use to map the drives.

Maybe you can adopt it for vb.

[system.Reflection.Assembly]::LoadWithPartialname("Microsoft.VisualBasic") | out-null

$u=new-object Microsoft.VisualBasic.Devices.ServerComputer

#test to see if the network is available

$tr=$u.network.isavailable

if ($tr -eq "True")

{

$a=get-wmiobject -namespace root/wmi "MSNdis_80211_BSSIList where active='true'"

$ssidname=""

#Find the Network Name

for($i=0; $i -lt 7; $i+=1){ $ssidname+=[Char]$a[1].Ndis80211BSSIList[0].Ndis80211SsId[$i]}

If ($ssidname -eq 'Network')

{

$An="Connected to the " + $ssidname + "network"

write-object $an

$a = ping Server

.

.

.

write-object 'Connected to Server'

$m=net use M: '\\Server\My Documents\My Music'

  Quote
Unfortunaley I don't do vbscript because vbscript is crap. I use monad (MSH) do all my scripts.
Oh I see... MSH looks powerful and I see it's still beta so never considered it. I wonder how many other people use it within a production environment...
  Quote
Put the vbs in a GPO in AD. If the client is not connected to AD, then the script can't run. Hence there are no problems.
It is a GPO within AD :] We use Offline Files (for laptop users) and somehow (cause I didn't do it!) this has been picked up as part of it cause I can see it's on the synchronization list. How did it get there? I guess I can just untick it and that should prevent it from being run offline?
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • But you don't own a licence. You are essentially renting it and give it back when they decided to revoke it.
    • All set as AI did the trick
    • NOPE! Too expensive still.
    • AnyDesk 9.5.7 by Razvan Serea AnyDesk is a fast remote desktop system and enables users to access their data, images, videos and applications from anywhere and at any time, and also to share it with others. AnyDesk is the first remote desktop software that doesn't require you to think about what you can do. CAD, video editing or simply working comfortably with an office suite for hours are just a few examples. AnyDesk is designed for modern multi-core CPUs. Most of AnyDesk's image processing is done con­currently. This way, AnyDesk can utilize up to 90% of modern CPUs. AnyDesk works across multiple platforms and operating systems: Windows, Linux, Free BSD, Mac OS, iOS and Android. Just five megabytes - downloaded in a glimpse, sent via email, or fired up from your USB drive, AnyDesk will turn any desktop into your desktop in se­conds. No administrative privileges or installation needed. AnyDesk 9.5.7 changelog: Fixed Bugs Fixed deadlock when updating chat server Fixed crashes caused by exceptions in internal communication layer Fixed crash when opening new monitor in Session in a new window Fixed crash on shutdown Fixed bug that allowed naming Permission Profiles identical to predefined Profiles Fixed bug that could cause licensed remote clients to show up as free Fixed visual bug that caused Set-Password button to show up when Unattended Access was disabled Fixed bug that lead to selecting the wrong initial resolution for webcams New Features Added command line option --record-screen to start a Screen Recording Other Changes Improved visual consistency in some list views Download: AnyDesk 9.5.7 | macOS ~14.0 MB (Free for private use, paid upgrade available) Links: AnyDesk Home Page | Other platforms | Release History | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • WUT?! Tell us you've never built desktop software without telling us you've never built desktop software... The chromium rendering engine is the content-rendering engine for "chromium-based browsers," but that does NOT mean there's a full-on UI underneath that is somehow bloating these products. The bloat is from the additional UI components that the browser vendor (Vivaldi) is adding atop the base package. Most chromium browsers customize the default skin/theme of the overall package so there's absolutely zero added overhead; it's really just a different CSS-based theme pack. Vivaldi, however, adds more than just a different skin; they add built-in extensions (that are managed by other built-in extensions), add other customization modules, and all kinds of other bloat -- and these add-ons are EXACTLY where the resource-hogging stems from. The mere fact it's a chromium-based browser has no impact on the matter. Lastly, power users literally DO notice resource-intensive applications -- they'll even be familiar with tools and widgets that expose those measurements the way only a power-user would! General consumers, however, would simply remark that their rig is sluggish and probably outdated and blindly upgrade to whatever the salespeople are hawking at the local computer store. General consumers wouldn't even upgrade their existing computer cuz they wouldn't know how to!
  • Recent Achievements

    • First Post
      Celilo earned a badge
      First Post
    • One Year In
      K.I.S.S. earned a badge
      One Year In
    • Week One Done
      solidox earned a badge
      Week One Done
    • Dedicated
      solidox earned a badge
      Dedicated
    • Week One Done
      Devesh Beri earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      442
    2. 2
      ATLien_0
      166
    3. 3
      +FloatingFatMan
      151
    4. 4
      Nick H.
      66
    5. 5
      macoman
      63
  • Tell a friend

    Love Neowin? Tell a friend!