Powershell Tip #22: Find GC (Global Catalog)

By | August 29, 2015

Tip: You can list the GC (Global Catalog) servers with Powershell.

Note: Get-ADDomainController is a cmdlet from the activediretory module.


previous-buttonnext-button

4 thoughts on “Powershell Tip #22: Find GC (Global Catalog)

  1. Pingback: Powershell Tip #21: Import specific cmdlets from a module | Powershell Guru

  2. Pingback: Powershell Tip #23: Get Tombstone Lifetime | Powershell Guru

  3. lalit

    Hi,
    I have a file myfile.txt and it has only one line. line is as given below.

    I wanted to replace if=”${copy}” to blank (wanted to delete if=”${copy}”) i.e. file line should be as given below

    I have tried with command
    powershell -Command “(gc myfile.txt) -replace ‘if=”${copy}”‘, ” | Out-File myfile.txt”
    but it does not replace with BLANK .

    Thanks,

    Reply
    1. Steve Renard Post author

      Hi,

      Use the Replace method instead.

      Replace operator
      (gc file.txt) -replace 'if="${copy}"', ""

      Replace method
      (gc file.txt).Replace('if="${copy}"', "")

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *