[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 727
  • Last Modified:

Logon scripts

Need to create a logon script so that xp clients logging onto server 2003 have mapped drives and proxy server settings assigned on logon. Failing dismally in acheiving this would appreciate some pointers.
0
rioja_robin
Asked:
rioja_robin
4 Solutions
 
jimstarCommented:
IE stores proxy settings in the registry, so you can execute a command like:
regedit /s z:\proxy.reg

This assumes that the Z drive is mapped properly before the above command executes. As for the reg file:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyServer"="<your proxy IP address>:8080"
"ProxyEnable"=dword:00000001
"ProxyOverride"="<local>"

0
 
fpcitCommented:
The mapped drive can be done with a command called net use and the proxy setting can be handled with a group policy.  

Here is a copy of the syntax for net use

NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
        [/USER:[domainname\]username]
        [/USER:[dotted domain name\]username]
        [/USER:[username@dotted domain name]
        [/SMARTCARD]
        [/SAVECRED]
        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]

so you mapped drive may look like this

net use x: \\server1\mappeddrive /user:user@domain.com /persistent:yes

Your users would be prompted for the password or you can put a password in clear text.  Putting a password in clear text isn't the best Idea.

One other thing to consider is if you are trying to map a users home directory this can also be done through Active Directory.  Use the tool Active Directory Users and Computers find the given users and look at the properties.  Find the Profile tab and look at home folder. Here you would map say the "H" drive to \\fileserver\username

Hope that helps
Cheers
0
 
rickardcCommented:
To create your drive mappings you'll need a logon script.  To do the proxy settings you'll need to use a group policy.

To create a logon script for the drive mappings do the following:
Create a text file called logon.bat.  Edit it in notepad and add your drive mapping like fpcit describes.
eg net use f: \\Fileserver\datashare
save the changes and copy it in the netlogon folder on your domain contoller.  eg \\dcname\netlogon.

Then in the active directory users and computers open the user, and go to the profile tab.  Enter logon.bat in the logon script box.

You'll need to wait a little while for the file to be replicated to all your domain controllers before it'll work.  The time this takes will depend on a number of things including how many sites you have and what domain functional level you are using.  Usually 15 minutes is a safe time to wait in a single site environment.

To do the proxy settings you'll need to create a group policy object.  First your should download and install the group policy managment tool (GPMC) from microsoft.  

http://www.microsoft.com/downloads/details.aspx?FamilyID=0a6d4c24-8cbd-4b35-9272-dd3cbfc81887&DisplayLang=en

open the GPMC from administrative tools, expand your domain and browse to the OU where your users are.  Right click on it and select create a GPO in this domain and link it here and give it a name.  Move down to Group policy objects, right click on your new policy and selct edit.  Next expand the user settings > windows settings > internet explorer maintenance > connection.  Double click on proxy settings, enter your proxy server and tick the enabled box.

Then close your policy and wait for your domain to replicate.  That should be it.

Hope that points you in the right direction.
Chris
0
 
itquestionsCommented:
Here is a vbs script to map drives.  The one section removes all currently mapped drives and then assigns the mappings.  You can also use the boolpersistant command like I have to keep the mappings permanent.

The previous posts on proxy settings are correct.  You should definitely use gpo's for that one.


Dim WSHNetwork, objNetwork, objShell, clDrives, boolPersistent
Set objNetwork = WScript.CreateObject("WScript.Network")
Set WSHNetwork = WScript.CreateObject("WScript.Network")
boolPersistent = True ' True = Persistent ; False = Not Persistent

On Error Resume Next
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
Next


'Map all drives
objNetwork.MapNetworkDrive "H:", "\\server\share1", boolPersistent
objNetwork.MapNetworkDrive "Z:", "\\server\share2"

Wscript.Quit
0
 
rioja_robinAuthor Commented:
Thanks to everyone for their help, very much appreciated.

Robin
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now