Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Prevent Output

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-30-2007   #1 (permalink)
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
Old 05-30-2007   #2 (permalink)
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
Old 05-30-2007   #3 (permalink)
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
Old 05-30-2007   #4 (permalink)
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
Old 05-30-2007   #5 (permalink)
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
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Password - Prevent or Allow to Change Brink Tutorials 8 08-01-2008 02:59 PM
How to prevent thumbnails joedee983 Media Center 0 07-01-2008 12:50 PM
How do I prevent ..... Mike Vista mail 1 11-19-2007 07:09 PM
The DVD ROM prevent me from starting Vista DeXtmL Vista General 3 10-05-2007 09:25 AM
No output from write-output DouglasWoods PowerShell 3 04-13-2007 11:36 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51