Link to home
Start Free TrialLog in
Avatar of mt3dek
mt3dekFlag for United States of America

asked on

Multiple GPO at logon

Hello all,

Here is what I am trying to accomplish. I am trying to have Mapped network drives removed during a logoff process then added when a user logs on, and i have a HTML file with our firm greeting on it.

I used to have all this in a batch file at one time and deploying out with every users profile through Active Directory.

I have gotten my network drives to be removed and added like i want them to. But when i had the GPO for the VBS opening up an HTML file, even though i have this GPO at the very last on the list to process, it would (through most of my testing) map one drive letter then try opening that HTML file that is trying to open through one of the drive letters being mapped. This failed since when the HTML file tried opening the drive it is located on did not add.

I can log off and back on, and things will be ok, maybe 3rd or 4th time it might work.

Any Ideas on how to get this accomplished?
Avatar of Matthias Abt
Matthias Abt
Flag of Germany image

Server 2003 or 2008?
Avatar of mt3dek

ASKER

Server 2003 R2 STD
http://www.mydigitallife.info/2006/09/13/group-policy-login-or-logon-scripts-not-running-not-working-or-not-executing/

This is usually caused by slow connections !
So you need to enforce the GP to work over slow connection ! not 100% guaranty that will work plus it slows down the client from logging in to the machine

Group Policy Troubleshooting:
http://technet.microsoft.com/en-us/library/cc736961%28WS.10%29.aspx

Optimize group policy object processing to protect network speed:
http://articles.techrepublic.com.com/5100-10878_11-5034267.html
Avatar of puterg33k
puterg33k

what if you call the HTML file from a UNC path (ie. \\server\sharename\htmlfile) rather than a drive letter?
i like puts idea..

or you could always code in a timer in the vbs script.. approximately 60 seconds..? or more..?
or you could always throw in some error checking waiting for the drive to appear :)

let me know if you want more info
Avatar of mt3dek

ASKER

Here is the Code i currently have. I would love to  put everything UNC path but every attempt something has gone wrong.
WScript.Sleep(10000)

dim objExplorer

open_ie
objExplorer.Document.Body.InnerHTML = HTMLTextfile("H:\PUBLIC\Login.htm")

'-------------------------------------------------------------------------------------------------------------------------------
'    open ie
'-------------------------------------------------------------------------------------------------------------------------------
sub open_ie
    Set objExplorer = CreateObject("InternetExplorer.Application")
        with objExplorer
    .Width=800
    .Height=600
    .Left=150
    .Top=50
    .Visible=true
    .navigate "H:\PUBLIC\Login.htm"
    'navigate "file:///H:\PUBLIC\Login.htm"    'alternative
end with
end sub


'-------------------------------------------------------------------------------------------------------------------------------
'    open fileobject
'-------------------------------------------------------------------------------------------------------------------------------
function HTMLTextfile(pathfile)
    Const ForReading = 1
    HTMLScr = ""
    pathfile = trim(pathfile)
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    set objFile = objFSO.GetFile(pathfile)
    Set objReadFile = objFSO.OpenTextFile(pathfile,ForReading)
    Do Until objReadFile.AtEndOfStream
        HTMLScr = HTMLScr & objReadFile.ReadLine
    Loop
    HTMLTextfile = HTMLScr
    objReadFile.Close
end function

Open in new window

I think an hta logon script would be more suited for what you are trying to do.  I have attached a simple HTA file that will map network drives.  You  should be able to modify the HTML section with your existing HTML code  and then update the drive mappings to your existing mappings.  

I would  recommend setting logon.hta as the logon script for every user rather  than trying to do it through GPO it just seems to be more reliable.  I would use the \\yourdomaincontroler\netlogon share as your repository for any images or files you call from this script.  This is also where you will need to store this file to call it as a logon script.

Here are a couple of articles with additional examples.  

http://gallery.technet.microsoft.com/ScriptCenter/en-us/site/search?f[0].Type=SearchText&f[0].Value=HTA&x=0&y=0

https://www.experts-exchange.com/articles/Web_Development/Miscellaneous/HTA-Hypertext-Application-tutorial.html


I had to save the file with a .txt extension so make sure to rename it to logon.hta.  You can use Notepad to make any changes to the hta file.

logon.txt
Avatar of mt3dek

ASKER

there are only two ways that i am aware of to set a logon script, either through gpo or setting it on the users AD account and i am not going to go to everyones AD account and add a logon script for it, that is the whole purpose of GP.
ASKER CERTIFIED SOLUTION
Avatar of puterg33k
puterg33k

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mt3dek

ASKER

This user helped accomplish what i wanted to accomplish