Michael Otey

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • Michael Otey
    Michael Otey
    Participant
    in reply to: Tip: Opening CMD window from Windows Explorer #614634

    Thanks for the follow up tips. I use PowerShell quite a bit but I still have a number of batch files around.¬† The thing I liked about this tips was that the commands are all in the current folder and there’s no need to use command line navigation to get there. :-)

    Michael Otey
    Michael Otey
    Participant
    in reply to: powershell #614537

    As Ossian pointed out there are a lot of good PowerShell resources on the Internet that you can find by googling. Two official Microsoft resources that are a good (and free) place to start are:

    Microsoft Docs: Getting Started with Windows PowerShell
    https://docs.microsoft.com/en-us/powershell/scripting/getting-started/getting-started-with-windows-powershell?view=powershell-6

    And the Microsoft Virtual Academy (MVA)Course: Getting Started with Microsoft PowerShell
    https://mva.microsoft.com/en-us/training-courses/getting-started-with-powershell-3-0-jump-start-8276?l=r54IrOWy_2304984382

    The MVA course may be moving in the near future but the link should be active until 4/30/2019

     

     

    Michael Otey
    Michael Otey
    Participant
    in reply to: Login Script #374556

    Re: Login Script

    chakotay2;206676 wrote:
    I did and you are exactly right. I swear it wasn’t working that way before… (lol… I love computers, I am sure I had something wrong before and didn’t notice).

    Thanks once again! :bowdown: Mark this one as SOLVED.

    You may have needed a “gpupdate” (group policy refresh). I don’t know for sure though.

    Michael Otey
    Michael Otey
    Participant
    in reply to: VBScript to change Profile Attributes in AD #374555

    Re: VBScript to change Profile Attributes in AD

    Rems;205461 wrote:
    If “cn=testing” is a group object, then the name objUser that you gave to the reference to the object is mostlikely making the confusion here. The object IS a group therefor it is better if you’d name it something like objGroup.

    Your script connects to the “cn=testing” group object in Active Directory,
    then it directly tries to edit attributes of that object which are not typically attributes beloning to a group object.

    The script should first enumerate the members of the group – then it have to connect to each of the user objects to be able to edit attributes of that object. You use a For-Each loop to get each of the members.

    Add objMember.SetInfo to the script to save the new values for the object.

    ‘ create an outstanding binding to Active Directory
    Set objRootDSE = GetObject(“LDAP://RootDSE”)
    strDNSDomain = objRootDSE.Get(“DefaultNamingContext”)

    ‘ create a reference to the group object
    Set objGroup = GetObject _
    (“LDAP://cn=testing,ou=Testing,ou=Technology,” & strDNSDomain)

    objGroup.GetInfoEx Array(“member”), 0

    If Not IsEmpty(objGroup.member) then
    ‘ connect to each object which is member of the group,
    ‘ Determine if the member is a user (since you’re editing
    ‘ attributes typically for user objects).
    For Each strMember in objGroup.GetEx(“member”)
    Set objMember = GetObject(“LDAP://” & strMember)
    If InStr(1, objMember.Class, “user”,1) Then
    objMember.Put “homeDirectory”, “\mpsnasusers” & objMember.sAMAccountName
    objMember.Put “homeDrive”, “U:”
    objMember.SetInfo
    End If
    Next
    End If
    [/CODE]Rems[/QUOTE]

    Hey, Thanks for that script! It works great! Only one problem, it seem to put it in the user home area, but it doesn’t seem to be applying it. If that makes any sense. It seems to me that it is putting the information in but not making it applicable to anything. It’s not actually creating a user home, it’s just putting text in the box. Any help on making it applicable?[CODE]
    ‘ create an outstanding binding to Active Directory
    Set objRootDSE = GetObject(“LDAP://RootDSE”)
    strDNSDomain = objRootDSE.Get(“DefaultNamingContext”)

    ‘ create a reference to the group object
    Set objGroup = GetObject _
    (“LDAP://cn=testing,ou=Testing,ou=Technology,” & strDNSDomain)

    objGroup.GetInfoEx Array(“member”), 0

    If Not IsEmpty(objGroup.member) then
    ‘ connect to each object which is member of the group,
    ‘ Determine if the member is a user (since you’re editing
    ‘ attributes typically for user objects).
    For Each strMember in objGroup.GetEx(“member”)
    Set objMember = GetObject(“LDAP://” & strMember)
    If InStr(1, objMember.Class, “user”,1) Then
    objMember.Put “homeDirectory”, “\mpsnasusers” & objMember.sAMAccountName
    objMember.Put “homeDrive”, “U:”
    objMember.SetInfo
    End If
    Next
    End If
    [/CODE]Rems

    Hey, Thanks for that script! It works great! Only one problem, it seem to put it in the user home area, but it doesn’t seem to be applying it. If that makes any sense. It seems to me that it is putting the information in but not making it applicable to anything. It’s not actually creating a user home, it’s just putting text in the box. Any help on making it applicable?

    Michael Otey
    Michael Otey
    Participant
    in reply to: VBScript to change Profile Attributes in AD #374554

    Re: VBScript to change Profile Attributes in AD

    Dumber;205377 wrote:
    You need to create a loop.
    Something like (not tested though since I don’t have an environment nearby)

    Code:
    Set objUser = GetObject _
    (“LDAP://cn=testing,ou=Testing,ou=Technology,dc=miamips,dc=net”)
    Foreach user in objuser do
    objUser.Put “homeDirectory”, “\mpsnasusers%username%”
    objUser.Put “homeDrive”, “U”
    Loop
    wscript.echo “Done”

    I don’t see how the loop helps. Can you explain? I want it to go for a whole group and not an individual user. Do I need to change something if I want that?

Viewing 5 posts - 1 through 5 (of 5 total)