Showing posts with label Windows 7. Show all posts
Showing posts with label Windows 7. Show all posts

Friday, July 18, 2014

Offline Files not coming back online when reconnecting to the network

So here's the problem we had. User has offline files on his H: drive (Home drive), so that he can access them while traveling.  If the user boots up his laptop and logs in, and THEN connects via VPN or work wireless, he can't access his H: drive at all.  He can still see his offline files, but they stay offline and all other files are not accessible.  Also if he disconnects his laptop goes to a meeting then comes back and docks he is unable to get access to his H: drive until he reboots.  The only way to get the files back online and have access to the rest of his H: drive is to log-in WHILE having a live network connection to the office.  After a bit of research I found the answer via mcseRob (See link below).

The short version is that the user needs read access to the folder that the share is pointed to, not just a sub-folder that his H: drive is pointing to.  Windows checks to see if the files are back online by checking the share itself!  So when it checks and doesn't have read access to the share it thinks the files are still offline.  So a quick fix is to give all users read access to the share itself.

For our situation we ONLY give read access to the share and not all the sub folders below.  This does allow everyone to see the sub-folder names, which may reveal user names.   But follow the link below for some possible fixes to that problem.

Source: http://social.technet.microsoft.com/Forums/windows/en-US/dccf79c0-af86-43e9-99c6-20a21c22c38c/offline-files-the-work-offlinework-online-button-disappears-from-windows-explorer-after-the?forum=w7itpronetworking

Thursday, October 13, 2011

Check to see if a VBS script has Admin rights


Came across a problem today where we were running a VBS script that was obviously designed expecting UAC to be turned off.  In looking for a way to elevate the script to Admin before running, I found some code to force the script to run as administrator without having to reghack each PC.  It took a combination of sites to get the code, but here it is.

On Error Resume Next
key = CreateObject("WScript.Shell").RegRead("HKEY_USERS\s-1-5-19\")
If err.number <> 0 Then
 Set objShell = CreateObject("Shell.Application")
 objShell.ShellExecute "wscript.exe", Chr(34) & _
 WScript.ScriptFullName & Chr(34), "", "runas", 1
 WScript.Quit()

End If


If you insert that code at the beginning of your script it will first check to see if the script has Administrative rights (Either through UAC, or XP admin) and if it doesn't it will relaunch the script using runas administrator.

Warning: I haven't tested this in Windows XP.  I know that the Check part will work, but don't know about the relaunch.


Reghack to get Run As Administrator in the context menu for .VBS files:
http://www.sevenforums.com/tutorials/152967-run-administrator-add-vbs-file-context-menu.html

UAC elevation code:
http://www.winhelponline.com/articles/185/1/VBScripts-and-UAC-elevation.html

Check for Admin rights code:
http://csi-windows.com/toolkit/csi-isadmin

Edited: 9-4-15 Thanks Hh Lohmann