Announcement

Collapse
No announcement yet.

How to map a drive to the desktop but machine specific not user?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to map a drive to the desktop but machine specific not user?

    The problem is I need to map a drive (shortcut) to a generic users desktop but only to specific machines in the domain. All the machines are the same build as well as hardware. All machines are XP Pro sp2 and fully patched. I had no problem with mapping by user so the GPs are working etc and I was told that you can only map to user specific accounts and not to machine specific accounts. Is there a work around?

    Heres the script which works fine by user

    Set objNet = WScript.CreateObject("WScript.Network")
    Set WshShell = CreateObject("WScript.Shell")
    DesktopPath = WshShell.SpecialFolders("Desktop")

    'map network drive
    objNet.MapNetworkDrive "T:", "\\Bss-main\Student\_Reception\Yr R 2007 - 2008", "True"

    'create a icon on the desktop
    Set link = WshShell.CreateShortcut(DesktopPath & "\Yr R 2007 - 2008.lnk")
    link.Description = "User Share Drive"
    link.HotKey = "CTRL+ALT+SHIFT+T"
    link.IconLocation = "explorer.exe,0"
    link.TargetPath = "T:"
    link.WindowStyle = 3
    link.Save

    So many thanks for your help here guys&.(Gals)

  • #2
    Re: How to map a drive to the desktop but machine specific not user?

    Hey,

    There are two things you could do here.

    I understand that you want the drives to be mapped only on specific Workstations...Does this set of workstations have something specific which can be used to differenciate them from other workstations? You could simply query the name of the workstation in your script and filter them.

    Or as you mentioned that you are using GPOs you could link the policy on the workstations OU and enabled loop back processing(preferably in merge mode) and Add the specific workstations to the GPO Filtering.


    MurTuzA
    The Never Ending Loop of User Rights
    START
    Q. Why is Windows so insecure?
    A. Because everyone runs as Administrator.
    Q. Why does everyone run as Administrator (even when they know better)?
    A. Because they don't understand security and are afraid they will be prevented from doing things.
    Q. Why don't they understand security?
    A. Because they run as Administrator, bypassing all security.
    LOOP TO START

    Comment


    • #3
      Re: How to map a drive to the desktop but machine specific not user?

      Originally posted by andyinjapan View Post
      only to specific machines in the domain. All the machines are the same build as well as hardware. All machines are XP Pro sp2 and fully patched.
      Like MurTuzA stated;
      To identify the right computer we have to know what separates them from the others.
      Are those computers in a special OU, or member of in a specific Group? Or can they reconized by part of the computer name or site or...

      If you use filtering by GPO,
      - Loopback processing on the computer's GPO, to computers where employees have to logon-to is most of the time not an option, since it automatically disables all the GPO's linked to the users OU.
      instead:
      - Try to use WMI filtering on the Linked GPO.
      http://forums.petri.com/showthread.p...ght=wmi+filter


      \Rems
      Last edited by Rems; 6th November 2007, 17:38. Reason: added a link, about WMI filtering

      This posting is provided "AS IS" with no warranties, and confers no rights.

      __________________

      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts

      Comment


      • #4
        Re: How to map a drive to the desktop but machine specific not user?

        Originally posted by Rems View Post
        Like MurTuzA stated;
        To identify the write computer we have to know what separates them from the others.
        Are those computers in a special OU, or member of in a specific Group? Or can they reconized by part of the computer name or site or...

        If you use filtering by GPO,
        - Loopback processing on the computer's GPO, to computers where employees have to logon-to is most of the time not an option, since it automatically disables all the GPO's linked to the users OU.

        instead:
        - Try to use WMI filtering on the Linked GPO.


        \Rems
        Hi there,
        All the PC's are in a different OU but I don't know how to write the script in order for that to take effect? If you are in the know please let me know....many thanks
        for your help...
        Andy

        Comment


        • #5
          Re: How to map a drive to the desktop but machine specific not user?

          Originally posted by Rems View Post
          Like MurTuzA stated;
          To identify the write computer we have to know what separates them from the others.
          Are those computers in a special OU, or member of in a specific Group? Or can they reconized by part of the computer name or site or...

          If you use filtering by GPO,
          - Loopback processing on the computer's GPO, to computers where employees have to logon-to is most of the time not an option, since it automatically disables all the GPO's linked to the users OU.

          instead:
          - Try to use WMI filtering on the Linked GPO.


          \Rems
          The laptops are in a differnet OU but as I mentioned in another reply I'm not sure about the writing of the script???
          Can you help out on that one?
          Many thanks
          Andy

          Comment


          • #6
            Re: How to map a drive to the desktop but machine specific not user?

            Originally posted by murtuza_13 View Post
            Hey,

            There are two things you could do here.

            I understand that you want the drives to be mapped only on specific Workstations...Does this set of workstations have something specific which can be used to differenciate them from other workstations? You could simply query the name of the workstation in your script and filter them.

            Or as you mentioned that you are using GPOs you could link the policy on the workstations OU and enabled loop back processing(preferably in merge mode) and Add the specific workstations to the GPO Filtering.


            MurTuzA
            Please see other replys
            ....many thanks
            for your help...
            Andy

            Comment


            • #7
              Re: How to map a drive to the desktop but machine specific not user?

              Hi there,
              All the PC's are in a different OU but I don't know how to write the script in order for that to take effect? If you are in the know please let me know....many thanks
              for your help...
              Andy
              The laptops are in a differnet OU but as I mentioned in another reply I'm not sure about the writing of the script???
              Can you help out on that one?
              Many thanks
              Andy
              Please see other replys
              ....many thanks
              for your help...
              Andy
              Hi Andy,

              To map a drive (shortcut) to a generic user's desktop "but only to specific computers in the domain"...

              Here a script you can use when all the laptops in the company are these computers mensioned above. Determine the chassistype of the computer could then be one of the methods you can use;
              Code:
              Const ChassisType__Other = 1
              Const ChassisType__Unknown = 2
              Const ChassisType__Desktop = 3
              Const ChassisType__Low_Profile_Desktop = 4
              Const ChassisType__Pizza_Box = 5
              Const ChassisType__Mini_Tower = 6
              Const ChassisType__Tower = 7
              Const ChassisType__Portable = 8
              Const ChassisType__Laptop = 9
              Const ChassisType__Notebook = 10
              Const ChassisType__Hand_Held = 11
              Const ChassisType__Docking_Station = 12
              Const ChassisType__All_in_One = 13
              Const ChassisType__Sub_Notebook = 14
              Const ChassisType__SpaceSaving = 15
              Const ChassisType__Lunch_Box = 16 
              Const ChassisType__Main_System_Chassis = 17
              Const ChassisType__Expansion_Chassis = 18
              Const ChassisType__SubChassis = 19
              Const ChassisType__Bus_Expansion_Chassis = 20
              Const ChassisType__Peripheral_Chassis = 21
              Const ChassisType__Storage_Chassis = 22
              Const ChassisType__Rack_Mount_Chassis = 23
              Const ChassisType__SealedCase_PC = 24
              
              Set objWMIService = GetObject("WinMgmts:" _
                  & "{impersonationLevel=impersonate}!root/cimv2")
              
              Set colChassis = objWMIService.ExecQuery _
                  ("Select ChassisTypes from Win32_SystemEnclosure")
              
              For Each objChassis in colChassis
                If IsLaptop = True Then Exit For
                  For  Each strChassisType in objChassis.ChassisTypes
                     Select Case strChassisType  '(if is one of... :
                        Case 8, 9, 10, 11, 12, 13, 14 'enter the types you want (refere to the Const variables above) 
                           IsLaptop = True
                           Exit For
                     End Select
                  Next
              Next
              
              If (IsLaptop) Then
              
                wscript.echo "Ths computer is a Laptop", "Your script starts from here"
              
              End If
              Or else,
              In the next example,
              when the target OU(s) are populated only by these computers and other computers are in other OU(s) with a different OU-child name, then you can try something like this;
              Code:
              '----- Target OU(s) -----------
              ListOfOUNames = _
                UCase(Join(Array("",_
                    "MyComputers",_
                    "TheirComputers",_
                    "OurComputers",_
                ""),"#"))
              '------------------------------
              
              
              'Determine the name of the OU this computer is located
              sComputerDN = CreateObject("ADSystemInfo").ComputerName
              sComputerOU = Mid( Split( sComputerDN, "," )(1), 4 )
              
              sMatch = UCase( "#" & sComputerOU & "#" )
              If (Instr(ListOfOUNames,sMatch)) Then 
              
                wscript.echo "This computer is in one of the OUs", "Your script starts from here"
              
              End If
              \Rems
              Last edited by Rems; 17th October 2007, 20:02.

              This posting is provided "AS IS" with no warranties, and confers no rights.

              __________________

              ** Remember to give credit where credit's due **
              and leave Reputation Points for meaningful posts

              Comment

              Working...
              X