![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Suppress output from a command line tool I'm writing a script that wraps nslookup to gather DNS information from multiple servers so I can confirm that they are in agreement. Unfortunately, when nslookup runs it always returns the following error for each lookup that I can't seem to suppress. *** Can't find server name for address 204.74.113.1: No information How can I get rid of this? Here's a sample NSLookup command that I'm running: nslookup blackbaud.com 204.74.112.1 If you run it, you can see there is plenty of other output, but only the error message is displayed when executed in a script. thanks for the help! -Chris |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Suppress output from a command line tool have to tried piping the output to a file and then parsing the file -- 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 "Chris Harris" wrote: > I'm writing a script that wraps nslookup to gather DNS information from > multiple servers so I can confirm that they are in agreement. > > Unfortunately, when nslookup runs it always returns the following error for > each lookup that I can't seem to suppress. > > *** Can't find server name for address 204.74.113.1: No information > > How can I get rid of this? > > Here's a sample NSLookup command that I'm running: > > nslookup blackbaud.com 204.74.112.1 > > If you run it, you can see there is plenty of other output, but only the > error message is displayed when executed in a script. > > thanks for the help! > > -Chris |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Suppress output from a command line tool Chris Harris wrote: > I'm writing a script that wraps nslookup to gather DNS information from > multiple servers so I can confirm that they are in agreement. > > Unfortunately, when nslookup runs it always returns the following error for > each lookup that I can't seem to suppress. > > *** Can't find server name for address 204.74.113.1: No information > > How can I get rid of this? > > Here's a sample NSLookup command that I'm running: > > nslookup blackbaud.com 204.74.112.1 > > If you run it, you can see there is plenty of other output, but only the > error message is displayed when executed in a script. > > thanks for the help! > > -Chris I'm struggling to determine exactly what you're looking to do. If you try this: 91# $lookup=nslookup blackbaud.com 204.74.112.1 *** Can't find server name for address 204.74.112.1: No information Then $lookup won't have that "No information" line, and use can use what $lookup contains for whatever you're trying to do? Marco |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Suppress output from a command line tool Thanks, Marco I am using a variable to hold the results (and the variable doesn't contain the error), but even when I do that the error message is displayed as in your example below. Thanks, chris "Marco Shaw" wrote: > Chris Harris wrote: > > I'm writing a script that wraps nslookup to gather DNS information from > > multiple servers so I can confirm that they are in agreement. > > > > Unfortunately, when nslookup runs it always returns the following error for > > each lookup that I can't seem to suppress. > > > > *** Can't find server name for address 204.74.113.1: No information > > > > How can I get rid of this? > > > > Here's a sample NSLookup command that I'm running: > > > > nslookup blackbaud.com 204.74.112.1 > > > > If you run it, you can see there is plenty of other output, but only the > > error message is displayed when executed in a script. > > > > thanks for the help! > > > > -Chris > > I'm struggling to determine exactly what you're looking to do. > > If you try this: > 91# $lookup=nslookup blackbaud.com 204.74.112.1 > *** Can't find server name for address 204.74.112.1: No information > > Then $lookup won't have that "No information" line, and use can use what > $lookup contains for whatever you're trying to do? > > Marco > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Suppress output from a command line tool "Chris Harris" <Chris Harris@discussions.microsoft.com> wrote in message news:3391ADF9-59E6-45D4-88A6-1C052C97C734@microsoft.com... > I'm writing a script that wraps nslookup to gather DNS information from > multiple servers so I can confirm that they are in agreement. > > Unfortunately, when nslookup runs it always returns the following error > for > each lookup that I can't seem to suppress. > > *** Can't find server name for address 204.74.113.1: No information > > How can I get rid of this? > > Here's a sample NSLookup command that I'm running: > > nslookup blackbaud.com 204.74.112.1 > > If you run it, you can see there is plenty of other output, but only the > error message is displayed when executed in a script. nslookup blackbaud.com 204.74.112.1 2>$null will redirect the error stream output to $null i.e. will cause it to not be displayed. -- Keith |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Suppress output from a command line tool Hi Keith, Redirecting to $null didn't seem to work as I still see the error message and my $result variableis null as well PS C:\Toolbox\Scripts\DNSCheck> $result = nslookup notices.dfwworld.org i.root-s ervers.net >$null *** Can't find server name for address 192.36.148.17: No information PS C:\Toolbox\Scripts\DNSCheck> $result PS C:\Toolbox\Scripts\DNSCheck> This has really got me stumped! -Chris "Keith Hill" wrote: > "Chris Harris" <Chris Harris@discussions.microsoft.com> wrote in message > news:3391ADF9-59E6-45D4-88A6-1C052C97C734@microsoft.com... > > I'm writing a script that wraps nslookup to gather DNS information from > > multiple servers so I can confirm that they are in agreement. > > > > Unfortunately, when nslookup runs it always returns the following error > > for > > each lookup that I can't seem to suppress. > > > > *** Can't find server name for address 204.74.113.1: No information > > > > How can I get rid of this? > > > > Here's a sample NSLookup command that I'm running: > > > > nslookup blackbaud.com 204.74.112.1 > > > > If you run it, you can see there is plenty of other output, but only the > > error message is displayed when executed in a script. > > nslookup blackbaud.com 204.74.112.1 2>$null > > will redirect the error stream output to $null i.e. will cause it to not be > displayed. > > -- > Keith > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Suppress output from a command line tool "Chris Harris" <ChrisHarris@discussions.microsoft.com> wrote in message news:3A7382B9-A457-47EE-86A0-BC9FCA24C3D4@microsoft.com... > Hi Keith, > Redirecting to $null didn't seem to work as I still see the error message > and my $result variableis null as well > > PS C:\Toolbox\Scripts\DNSCheck> $result = nslookup notices.dfwworld.org > i.root-s > ervers.net >$null > *** Can't find server name for address 192.36.148.17: No information > PS C:\Toolbox\Scripts\DNSCheck> $result > PS C:\Toolbox\Scripts\DNSCheck> You have to have a "2" in front of the redirect operator. It tells PowerShell to redirect only the stderr stream to null. Try it this way: $result = nslookup notices.dfwworld.org i.root-servers.net 2>$null -- Keith |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| how to log output from a command line program | VB Script | |||
| Re: Send command line via WMI - Pipe output to text file on remote | PowerShell | |||
| BitLocker Command Line Tool? | Vista security | |||
| Wmic command-line tool in Vista 64 | Vista General | |||
| Output Event Log From Command Line | Vista General | |||