Prevent Output


  1.    30 May 2007 #1
    ryanlsanders@gmail.com Guest

    Prevent Output


    I have this script (yes I am using some stuff from Quest)

    $VAR = 0
    while ($VAR -ne 10)
    {
    $VAR++
    New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name
    "Test User$var"
    }


    How can I prevent the script from showing a line for each user added.
    I just want a output line when the script has run.

      My System SpecsSystem Spec

  2.    30 May 2007 #2
    Keith Hill [MVP] Guest

    Re: Prevent Output


    <ryanlsanders@gmail.com> wrote in message
    news:1180555213.973716.171960@q69g2000hsb.googlegroups.com...
    >I have this script (yes I am using some stuff from Quest)
    >
    > $VAR = 0
    > while ($VAR -ne 10)
    > {
    > $VAR++
    > New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name
    > "Test User$var"
    > }
    >
    >
    > How can I prevent the script from showing a line for each user added.
    > I just want a output line when the script has run.
    >


    You have a couple of options:

    $results = New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name
    "Test User$var"

    if you want to keep the output of this cmdlet. If you don't want the output
    at all then you could also do this:

    New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name "Test
    User$var" > $null

    --
    Keith


      My System SpecsSystem Spec

  3.    30 May 2007 #3
    dreeschkind Guest

    RE: Prevent Output


    Piping to out-null should do the trick:

    $VAR = 0
    while ($VAR -ne 10)
    {
    $VAR++
    New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name "Test
    User$var" | out-null
    }

    --
    greetings
    dreeschkind

    "ryanlsanders@gmail.com" wrote:

    > I have this script (yes I am using some stuff from Quest)
    >
    > $VAR = 0
    > while ($VAR -ne 10)
    > {
    > $VAR++
    > New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name
    > "Test User$var"
    > }
    >
    >
    > How can I prevent the script from showing a line for each user added.
    > I just want a output line when the script has run.
    >
    >

      My System SpecsSystem Spec

  4.    30 May 2007 #4
    RichS Guest

    RE: Prevent Output


    $null = New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name
    "Test User$var"

    should work as well

    --
    Richard Siddaway
    Please note that all scripts are supplied "as is" and with no warranty
    Blog: http://richardsiddaway.spaces.live.com/
    PowerShell User Group: http://www.get-psuguk.org.uk


    "dreeschkind" wrote:

    > Piping to out-null should do the trick:
    >
    > $VAR = 0
    > while ($VAR -ne 10)
    > {
    > $VAR++
    > New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name "Test
    > User$var" | out-null
    > }
    >
    > --
    > greetings
    > dreeschkind
    >
    > "ryanlsanders@gmail.com" wrote:
    >
    > > I have this script (yes I am using some stuff from Quest)
    > >
    > > $VAR = 0
    > > while ($VAR -ne 10)
    > > {
    > > $VAR++
    > > New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name
    > > "Test User$var"
    > > }
    > >
    > >
    > > How can I prevent the script from showing a line for each user added.
    > > I just want a output line when the script has run.
    > >
    > >

      My System SpecsSystem Spec

  5.    30 May 2007 #5
    klumsy@xtra.co.nz Guest

    Re: Prevent Output



    > $VAR = 0
    > while ($VAR -ne 10)
    > {
    > $VAR++
    > [void] ( New-QADUser -ParentContainer 'OU=Test,DC=domain,DC=local' -Name "Test User$var" )
    >
    > }
    >


    casting to void works.. here being a cmdlet you gotta put the
    expression in a ()

    but if its say just a method on a dotnet object you could do

    [void]$a.additem()

      My System SpecsSystem Spec

Prevent Output

Similar Threads
Thread Forum
MS Outlook. Prevent Reply to All.
HINTS TO HELP YOU. Read further - Prevent Reply to All | MSOutlook.info
Software
Prevent DLL from being referenced
How can I prevent a third-party user from referencing the object that i1ve created? Strong name will prevent from diasemblying only, right?? i...
.NET General
Prevent abortion of shutdown
Hey guys, I need a way to stop all users aborting a system shutdown via the /a arguement. Any ideas? Thanks
System Security
Enexpected output when using output-csv
when I add the Output-csv my my code, I get different output than what I got on the screen. Here's my code: @( ForEach($user in Get-Content...
PowerShell
How to prevent thumbnails
I have a bunch of avi files encoded with divx 6.7. I used 4cc changer to show them as xvid. In the media center window they used to show up as a...
Software
How do I prevent .....
How do I prevent Windows Mail from opening until the right password is entered? Mike -- Michael D Mayhue Vice President, Sales and Marketing...
Vista mail
No output from write-output
I have this script, which does not run as I expected. ---------------------------------------- function foo($bar) { write-output "I got $bar" }...
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • Old server
    About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 00:26.
    .