+ Post New Thread
Results 1 to 8 of 8
Scripts Thread, Opening Home Directory in Explorer in Coding and Web Development; Hello! I'm new to creating batch files and at the moment I have the following command: dsquery user domainroot -name ...
  1. #1

    Join Date
    May 2008
    Location
    Cheshire
    Posts
    292
    Thank Post
    48
    Thanked 27 Times in 24 Posts
    Rep Power
    18

    Post Opening Home Directory in Explorer

    Hello!

    I'm new to creating batch files and at the moment I have the following command:

    dsquery user domainroot -name %1 | dsget user -hmdir

    %1 being the pupil's username. It queries the AD, and returns with the home directory of the pupil. However, I'm wishing to open this folder. I've tried the following with no joy:

    start dsquery user domainroot -name %1 | dsget user -hmdir
    start | dsquery user domainroot -name %1 | dsget user -hmdir
    dsquery user domainroot -name %1 | dsget user -hmdir | start

    Many thanks for your help!

  2. #2

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,262
    Thank Post
    242
    Thanked 1,572 Times in 1,252 Posts
    Rep Power
    340
    I'm not sure about your script, but I presume you know you can do this with Folder Redirection in Active Directory? Relatively simple to setup and reliable too.

  3. #3

    Join Date
    May 2008
    Location
    Cheshire
    Posts
    292
    Thank Post
    48
    Thanked 27 Times in 24 Posts
    Rep Power
    18
    I've currently created an Access database (linking into the library database for the pupils information) which changes the pupils password automatically after they scan in their library card. Also forcing them to change the password at logon.

    Due to this, I thought it would also be a good idea to add a feature for admin, to open their home directory folder without the need of accessing AD, or the use of opening another program/document.

    The only reason I'm doing it as a .bat is because it's a quick easy fix and makes my life easier than even trying to do a VBA code for it :-)

  4. #4

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,262
    Thank Post
    242
    Thanked 1,572 Times in 1,252 Posts
    Rep Power
    340
    I understand Sounds like you're working on a nice project there!

  5. #5

    Join Date
    May 2008
    Location
    Cheshire
    Posts
    292
    Thank Post
    48
    Thanked 27 Times in 24 Posts
    Rep Power
    18
    Wow, thank you!

    Does the job, splended!

  6. #6

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    What format are you getting the username in? If you've got the full distinguished name in a variable called sDN then you can use:

    Code:
    set oShell=createobject("wscript.shell")
    set oUser=getobject("LDAP://" & sDN)
    oShell.run oUser.homedirectory
    in your VB code. If you just have the samaccountname then you can do

    Code:
    set oShell=createobject("wscript.shell")
    set oUser=getobject("WinNT://" & sDomain & "/" & sUser)
    oShell.run oUser.homedirectory
    (where sUser is the username and sDomain is the NetBIOS name of the domain)

  7. #7

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    sure; sometimes it's useful to have a comparison of various methods - that way you can work out what suits.

    batch file method is good because the commands can just be typed at the prompt which sometimes makes life easier if it's a one-off.

  8. #8

    Join Date
    May 2008
    Location
    Cheshire
    Posts
    292
    Thank Post
    48
    Thanked 27 Times in 24 Posts
    Rep Power
    18
    The format is just the login name, each year group has a different OU. That's why I've done a lookup for the user's ou then piped it into the reset password section.

    The only reason I went with .bat is because it's quick and easy. Maybe 'dirty' but easy, I like it when things are easy!

    If there is a more efficient way using VB Script, please tell me. I just thought it would be difficult to do the same thing?

SHARE:
+ Post New Thread

Similar Threads

  1. Stop explorer opening up lots of windows
    By dezt in forum How do you do....it?
    Replies: 3
    Last Post: 22nd May 2008, 02:05 PM
  2. network home directory ?
    By mac_shinobi in forum Mac
    Replies: 7
    Last Post: 29th April 2008, 01:55 PM
  3. Active Directory Explorer
    By ajbritton in forum Windows
    Replies: 6
    Last Post: 15th November 2007, 10:37 PM
  4. Active Directory Explorer v1.0
    By PiqueABoo in forum Downloads
    Replies: 1
    Last Post: 16th July 2007, 10:02 PM
  5. Home Directory Creation - how ??
    By pooley in forum How do you do....it?
    Replies: 4
    Last Post: 26th April 2007, 12:49 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •