locked
Get-content variable RRS feed

  • Question

  • Hi.

    I have a list of servers in C:\Servers.txt

    So I do :

    $servers = get-content C:\Servers.txt

    I then want to use each servername from $servers in the following command :

    Get-CertificationAuthority –name testCA | Get-issuedRequest | where-object {$_. Request.RequesterName -eq $servers}

    Any ideas ?

    Thanks

    Thursday, June 28, 2012 3:26 PM

Answers

  • Something like this?

    $servers = get-content C:\Servers.txt 
    foreach ($server in $servers) {
        Get-CertificationAuthority –name testCA | Get-issuedRequest | where-object {$_.Request.RequesterName -eq $server}
        }


    Grant Ward, a.k.a. Bigteddy

    • Proposed as answer by Just Karl Friday, June 29, 2012 8:02 PM
    • Marked as answer by Yan Li_ Monday, July 2, 2012 5:21 AM
    Thursday, June 28, 2012 3:38 PM