![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | do not display "ERRORS" when running script without using $erroractionpreference = "SilentlyContinue" In the scripts which i had, i delibrately search for a *non-existent* registry in the machine which creates an error. Also i want to run the script in a command prompt and only display msg via "write-host" instead of *default error messages* displaying when scripts run. # open a registry hive that does not exist on a machine -- example, do something here that generates an error -- however error *immediately* appear I do not want error message to display. I can use $erroractionpreference = "SilentlyContinue" in the first line of the script. However if i comment out this statement, error message will definitely appear. Is there a way to NOT TO DISPLAY error msg or CAPTURED MSG without using the $erroractionpreference = "SilentlyContinue" ? |
My System Specs![]() |
| | #2 (permalink) |
| | RE: do not display "ERRORS" when running script without using $errora Do you really want not to know of any error? Granted some of noise is not liked in some circumstances. The two parameters you will need to check out are described in the about_CommonParmaters helpfile. Specifically you will want to set ErrorAction to SilentlyContinue and I hope ErrorVariable to <some variable that you will examine later>. This will give you the ability to select how errors are propogated on a per call basis. This will override the global setting ErrorActionPreference. "IT Staff" wrote: Quote: > In the scripts which i had, i delibrately search for a *non-existent* > registry in the machine which creates an error. Also i want to run the > script in a command prompt and only display msg via "write-host" instead of > *default error messages* displaying when scripts run. > > # open a registry hive that does not exist on a machine > -- example, do something here that generates an error > -- however error *immediately* appear > > I do not want error message to display. > > I can use $erroractionpreference = "SilentlyContinue" in the first line of > the script. However if i comment out this statement, error message will > definitely appear. Is there a way to NOT TO DISPLAY error msg or CAPTURED > MSG without using the $erroractionpreference = "SilentlyContinue" ? > > > > > > > > > > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: do not display "ERRORS" when running script without using$erroractionpreference = "SilentlyContinue" On Feb 26, 7:32*pm, "IT Staff" <jkk...@xxxxxx> wrote: Quote: > In the scripts which i had, i delibrately search for a *non-existent* > registry in the machine which creates an error. Also i want to run the > script in a command prompt and only display msg via "write-host" instead of > *default error messages* displaying when scripts run. > > # open a registry hive that does not exist on a machine > -- example, do something here that generates an error > -- however error *immediately* appear > > I do not want error message to display. > > I can use $erroractionpreference = "SilentlyContinue" in the first lineof > the script. However if i comment out this statement, error message will > definitely appear. Is there a way to NOT TO DISPLAY error msg or CAPTURED > MSG without using the $erroractionpreference = "SilentlyContinue" ? trying to get just that one operation to not display errors, then you can use the -ea 'SilentlyContinue' switch on the command instead of editing the preference variable. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Unwanted Multiple contacts in "To","CC","BCC" of email send catago | Vista mail | |||
| ATI Drivers causing "display driver stopped responding" errors | Drivers | |||
| Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" | Vista General | |||
| How can I add the icons "Delete", "Cut", "Copy" and "Paste" in Vis | Vista file management | |||
| WM5 Sync with Vista "Windows Calender", "Contacts", and "Mail" | Vista General | |||