Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

groups in group Policy? 2

Status
Not open for further replies.

rocker40

IS-IT--Management
Apr 5, 2004
55
US
I have been unable to get a group to work in a group policy. I made a test OU and applied a group policy to it.
Then I made a security group and added 2 users to it. When I added the group to the OU the policy is not applied ?
If I just move the users over from USER OU into the test OU the policy does Apply. There is no group policy applied to the user OU. I would like to put them under this OU in groups incase I need to add them to a addtional OU in the train.
I had some step by step instructions I looked up on google but no luck with them either.
Can any body help with this?
 
As was stated above, you need to put your login scripts under User Settings, Scripts, Logon. make the files have a .VBS extension. You can create and delete drive mappings in VBScript almost the same way as you are used to. The following example will first clear a drive mapping then set it:

Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.RemoveNetworkDrive "U:"
WSHNetwork.MapNetworkDrive "U:", "\\server\users",True

If you want a more comprehensive login script to do a lot more for you, then give this a try:

'==========================================================================
'
' NAME: LogonScript
'
' AUTHOR: Mark D. MacLachlan, The Spider's Parlor
' URL : ' DATE : 4/10/2003
'
' COMMENT: Enumerates current users' group memberships in given domain.
'
'==========================================================================


ON ERROR RESUME NEXT

Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
DomainString = "DomainName"
UserString = WSHNetwork.UserName

Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)

'Synchronizes the time with Server our NTP Server
WSHShell.Run "NET TIME \\Server /set /y"


WSHNetwork.RemoveNetworkDrive "F:"

wscript.sleep 300

'Maps drives needed by all
WSHNetwork.MapNetworkDrive "U:", "\\server\users",True
WSHNetwork.MapNetworkDrive "X:", "\\server\executables",True

'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups

Select Case GroupObj.Name
'Check for group memberships and take needed action
Case "Admin"
WSHNetwork.MapNetworkDrive "w:", "\\Server\Admin Stuff",True
Case "WorkerB"
WSHNetwork.MapNetworkDrive "w:", "\\Server\Shared Documents",True

End Select

Next


'Install Printers

WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"



set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing

wscript.quit


I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
markdmac
I used that simple script you had at the top that just maps the drive. When I log in as the test user and open my computer it tells me no such network drive
says that WSHNetwork does not exist.
where did I go wrong? Below is what I used.. I changed the servername and drive of course to reflect mine.
Thanks
Dave

Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.RemoveNetworkDrive "U:"
WSHNetwork.MapNetworkDrive "U:", "\\server\users",True

 
Verify that you have Windows Script Host (WSH) 5.6 installed.

You can grab it from microsoft.com/scripting

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
I do have the WSH 5.6 installed on the server. when I log on with a user in the group policy where I have the script applied it runs but gives me this message..
script:
\\server\folder.............
line: 2
char: 1
error: the network name cannot be found.

code: 80070043
Source: WSHNetwork.mapnetworkdrive

which the source does reflect what line 2 says
any Thoughts??
Thanks
Dave




 
You need to have WSH 5.6 installed on the client where the script is running. Remember that Group Policy just houses the script. It actually executes on the client.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top