PowerShell

Fixing DN from Canonical name and the Timestamp 1/01/1601 11:00:00 in .CSV file?

Share
Viewing 3 reply threads
  • Author
    Posts
    • #1074396
      IT Engineer
      Participant
      • Topics: 5
      • Replies: 5
      Post count: 9
      Member Points: 416
      Rank: Level 2

      Hi People

      I’d like to get some assistance in fixing the PowerShell script below to list the member of an AD security group called Domain Admins and export it to .CSV file.

      The problem with the script above is:

      1. The LastLogon date/time stamp is always showing as 1/01/1601 11:00:00 AM.
      2. The column that is filled correctly is just the AD Group Name and the TimeStamp like above?

      Thank you very much in advance.

      0
    • #1074407
      Leonard Hopkins
      Participant
      • Topics: 5
      • Replies: 21
      Post count: 4
      Member Points: 753
      Rank: Level 2

       

      2+
      avataravatar
    • #1074415
      Leonard Hopkins
      Participant
      • Topics: 5
      • Replies: 21
      Post count: 4
      Member Points: 753
      Rank: Level 2

      BTW, the encrypted credentials are prefaced with “adm”. In our environment, privileged accounts are called “adm.username”. If you use this, simply substitute what your environment uses or just remove the “adm”.

      0
      • #1074434
        IT Engineer
        Participant
        • Topics: 5
        • Replies: 5
        Post count: 9
        Member Points: 416
        Rank: Level 2

        Leo, many thanks for sharing the great script 🙂
        this is so cool and more than what I need.

        I thank you for the help.

        0
        • #1076870
          Leonard Hopkins
          Participant
          • Topics: 5
          • Replies: 21
          Post count: 4
          Member Points: 753
          Rank: Level 2

          May be more than what you think you need, but trust me in large environments where group nesting has gone haywire, you need to be able to get a report on how many users are in a group.

          We had amateur admins granting access to data based upon a group not knowing that others were nested in the group. This caused a serious security breech since users in the nested groups were not supposed to have access to the data.

           

          0
    • #1074419
      Luc Fullenwarth
      Moderator
      • Topics: 7
      • Replies: 161
      Post count: 298
      Member Points: 16,066
      Rank: Level 4

      Your problem comes from the fact that you are not providing all needed properties in line 50.

      Here is a possible solution:

       

      2+
      avataravatar
      • #1074430
        IT Engineer
        Participant
        • Topics: 5
        • Replies: 5
        Post count: 9
        Member Points: 416
        Rank: Level 2

        That is great, thanks for the sharing and the update guy.

        @Luc: when I execute your script, the OU Location content is always showing as @{CanonicalName=Domain.com/All Corp/Domain Admin Accounts/Global.Admin}

        Isthere any way to fix that result?

        0
        • #1075342
          Luc Fullenwarth
          Moderator
          • Topics: 7
          • Replies: 161
          Post count: 298
          Member Points: 16,066
          Rank: Level 4

          @itengineer

          How do you want it to look like?

          1+
          avatar
Viewing 3 reply threads
  • You must be logged in to reply to this topic.
© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account