Windows Vista Forums

is this efficient ?

  1. #1


    IT STAFF Guest

    is this efficient ?

    $computerlist = gc c:\computers.txt


    $computerlist | get-qadcomputer | foreach {

    ' do whatever extraction



    }


    ========================================

    Is there a faster way or efficient way to writing it ?



      My System SpecsSystem Spec

  2. #2


    proxb Guest

    Re: is this efficient ?

    Maybe this?

    gc C:\computerlist.txt | get-qadcomputer | % { }

    On Apr 26, 2:11*am, "IT STAFF" <jkk...@newsgroup> wrote:

    > $computerlist = gc c:\computers.txt
    >
    > $computerlist | get-qadcomputer | foreach {
    >
    > * ' *do whatever extraction
    >
    > }
    >
    > ========================================
    >
    > Is there a faster way or efficient way to writing it ?

      My System SpecsSystem Spec

  3. #3


    proxb Guest

    Re: is this efficient ?

    gc c:\computers.txt | get-qadcomputer | % {#do whatever}


    On Apr 26, 2:11*am, "IT STAFF" <jkk...@newsgroup> wrote:

    > $computerlist = gc c:\computers.txt
    >
    > $computerlist | get-qadcomputer | foreach {
    >
    > * ' *do whatever extraction
    >
    > }
    >
    > ========================================
    >
    > Is there a faster way or efficient way to writing it ?

      My System SpecsSystem Spec

  4. #4


    IT STAFF Guest

    Re: is this efficient ?

    probably i should have ask "what is the performance like "

    eg

    foreach ($computers in get-qadcomputer) { #will this be better}


    "proxb" <boeprox@newsgroup> wrote in message
    news:c3baba59-080d-4a04-b24a-24609f5473ad@newsgroup
    gc c:\computers.txt | get-qadcomputer | % {#do whatever}


      My System SpecsSystem Spec

  5. #5


    Chris Dent Guest

    Re: is this efficient ?


    If you have a choice of these two the second is more efficient because
    it will use less RAM on the system executing the script:

    ForEach ($Computer in $(Get-QADComputer)) { }
    Get-QADComputer | %{ }

    However, without knowing what happens inside the loop it is impossible
    to say which is more appropriate. The loop must have context for
    efficiency to be evaluated.

    HTH

    Chris

    IT STAFF wrote:

    > probably i should have ask "what is the performance like "
    >
    > eg
    >
    > foreach ($computers in get-qadcomputer) { #will this be better}
    >
    >
    > "proxb" <boeprox@newsgroup> wrote in message
    > news:c3baba59-080d-4a04-b24a-24609f5473ad@newsgroup
    > gc c:\computers.txt | get-qadcomputer | % {#do whatever}
    >
    --
    Blog: http://www.indented.co.uk
    DnsShell: http://code.msdn.microsoft.com/dnsshell

      My System SpecsSystem Spec

is this efficient ?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Phishing filter TOO efficient Nora Vista mail 1 11 Jul 2009
Most efficient virtual machine? John Virtual PC 2 30 May 2009
Efficient way to send alerts willste .NET General 2 29 May 2009
Most efficient way to copy large volume of files QSIDeveloper .NET General 1 03 Jun 2008
A more efficient way to copy files? George Vista file management 0 21 Jul 2007