Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6559693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:21:43+00:00 2026-05-25T13:21:43+00:00

Back in my (limited) java programming days, I remember this nice feature where if

  • 0

Back in my (limited) java programming days, I remember this nice feature where if I tried to make a call that could throw an exception, java would require me to handle that exception or pass it off to something that could.

Anyways, I am writing a piece of powershell code that messes around with objects in Active Directory, so I want to be very, very careful. I’ve gotten occasional remote timeout errors, and that is leading me toward the more general question:

“How can I know ahead of time which of these cmdlets can throw exceptions indicating dangerous conditions, and what is the list of those possible exceptions?”

I am wondering if the list of exceptions, per cmdlet, is way too long to address all possibilities. I also don’t want to just write a generic exception handler, as powershell seems to do OK in the general sense of error handling.

What’s the best way to determine, per cmdlet, the list of all exceptions that can occur? Is this even possible / feasible?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:21:44+00:00Added an answer on May 25, 2026 at 1:21 pm

    Heh, I think you started out on the wrong foot there. The jury is very much out on whether Java’s checked exceptions are a nice idea.

    That said, what you ask is very difficult to answer. In Java, it’s clear to the compiler through static analysis what methods throw (or at least what they declare they will throw) what exceptions; this is a closed system existing solely in the process space of the compiler. In the real world of distributed heterogeneous systems, there is no universal checked exception framework. PowerShell cmdlets exist in the domain of a .NET appdomain in a win32 process, but they talk to backing systems on foreign servers using obtuse protocols like Active Directory which are a world apart both in implementation and general conception. Exceptional conditions may “flow” from one domain to the next, but they get warped, wrapped and mushed in all directions before they bubble up to you, the poor user at the console. In short, the answer is no. The general purpose Cmdlets (get-item, get-childitem) do not know about the underlying provider system’s propensity to cause errors, and nor can they reliably know this.

    However, if you have a dedicated module for Active Directory (like ActiveDirectory module from Microsoft, or Quest’s QAD module) then it’s possible they have listed the exceptions that their cmdlets will surface in the case of exceptional conditions in the backing system. This help would be found – most likely – in the module (or snapin) help files, or on a per-cmdlet basis. Try running the following command:

    ps> get-help do-something -full | more
    

    This will show the full invocation syntax along with any notes the developers have felt good enough to bless you with. Pay particular attention to the footer; it’s here you’ll usually find a more general help topic like “about_thesecmdlets” that you may view with: get-help about_thesecmdlets

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A while back I was using Virtual Private Server (VPS) that had very limited
Back in the old days, Help was not trivial but possible: generate some funky
Back in VB6, I wrote a few functions that would let me code without
Back in the days of Unix, you couldn't even close a software without reading
Back in the scripted ASP and ColdFusion days, I used to work on projects
Back in the ITAR era, there was a popular sig that performed Diffie-Hellman key
I am working on a WISE Installer that needs to run on Java Version
I have a Java web application that has a 'disconnected' Java Swing desktop app.
I'm building a CLI survey app in Java that lets users answer multiple-choice questions.
I have some image processing Java code in Android that acts upon two large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.