how to see whats in the variable System.DirectoryServices.ActiveDirectory.Active

Welcome Forums General PowerShell Q&A how to see whats in the variable System.DirectoryServices.ActiveDirectory.Active

Viewing 2 reply threads
  • Author
    Posts
    • #205785
      Participant
      Topics: 2
      Replies: 0
      Points: 27
      Rank: Member

      How do I get what’s inside this variable?

       

      So far I did:

      “c:\windows\system32\windowspowershell\v1.0\powershell.exe” -command “& {Get-ADReplicationConnection }”

      and one of the lines it gave is:

      ReplicationSchedule : System.DirectoryServices.ActiveDirectory.ActiveDirectorySchedule

       

      How do I get the ReplicationSchedule out of System.DirectoryServices.ActiveDirectory.ActiveDirectorySchedule

       

      Thanks

       

    • #205797
      Participant
      Topics: 5
      Replies: 322
      Points: 446
      Helping Hand
      Rank: Contributor

      I don’t have access to my ActiveDirectory environment to test, but try this.

      (Get-ADReplicationConnection).ReplicationSchedule
    • #206109
      Participant
      Topics: 2
      Replies: 1013
      Points: 2,093
      Helping Hand
      Rank: Community Hero

      This …

      System.DirectoryServices.ActiveDirectory.ActiveDirectorySchedule

      … is not a variable, this is a .Net namespace…

      https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.activedirectoryschedule?view=netframework-4.8

      System.DirectoryServices namespace provides an ADSI wrapper for programmatic access to Active Directory.  In PowerShell this is wrapped even further by the provision of the [ADSI] constructor.  This namespace is used to administer the data held within Active Directory e.g. Users, groups computers etc.

      … you’d use to get information to put into a variable to work with later.

      As pointed to in the other response… this..

      Get-ADReplicationConnection

      …can be used instead. What you get back is the properties of the request that has info in them.

      Did you look at the help files on your system or online…

      https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-adreplicationconnection?view=winserver2012-ps

      … and those samples to determine your use case?

      As well as the other article resources on what gets returned.

      http://www.rebeladmin.com/2018/01/troubleshooting-active-directory-replication-issues-powershell-guide/

      https://blogs.technet.microsoft.com/poshchap/2014/05/23/one-liner-find-manually-created-replication-connection-objects/

      What you are seeing is the property from that command and the results in that property.  So, if you take you variable thought process, this…

      ReplicationSchedule

      … is the variable and this …

      System.DirectoryServices.ActiveDirectory.ActiveDirectorySchedule

      … is what’s in it. Yet, again, that is a proper property, not a $Variable you created.

      There are scripts/modules on the MS powershellgallery.com that you can use as-is or teak as needed to get at this sort of info.

       

       

Viewing 2 reply threads
  • The topic ‘how to see whats in the variable System.DirectoryServices.ActiveDirectory.Active’ is closed to new replies.