How to determine built-in impact levels of native cmdlets

This topic contains 2 replies, has 1 voice, and was last updated by  Kevyn 3 months, 2 weeks ago.

  • Author
    Posts
  • #78482

    Kevyn
    Participant

    I'm trying to determine the easiest way to find out the built-in ConfirmImpact level of cmdlets (Ex: Restart-Computer, Remove-*, Set-*, etc...). I found the first article below that says the first step "...is to determine the full path of the .dll that contains the cmdlet for which we need to know the ConfirmImpact parameter.". The article shows you how to do that via the Get-Command cmdlet. Then it mentions one of a few tools, such as ildasm.exe, that can be used to pull out the information. From what I'm reading, ildasm.exe is free and is part of Visual Studio and also at least the Windows 7 SDK (I'm guessing it's also part of the Windows 10 SDK). Is there a better way to do this? If not, what is the bare minimum (i.e. the least amount of hard drive space taken) I'd need to install for Visual Studio or the Windows 10 SDK (Assuming the ildasm.exe is part of it)?

    https://dotnetjes.wordpress.com/2014/04/04/determine-the-corfirmimpact-parameter-of-a-powershell-cmdlet/
    https://docs.microsoft.com/en-us/dotnet/framework/tools/ildasm-exe-il-disassembler

  • #78490

    Kevyn
    Participant

    I found the answer to my question. The part of the code at the below blog that deals with the cmdlets seems to work well. However, the part that deals with determining the impact for functions can return incorrect information if the location (Ex: The line the ConfirmImpact piece is on is actually in $c[2], as was the case in a function I wrote) and/or formatting of the ConfirmImpact piece (Ex: ConfirmImpact='High' VS ConfirmImpact="High") is different than what his code is expecting.

    t*6f%YEcw#CPJb)2a3H_?$~ejDdK{VBLp ZQ=x9]nG5vUo}lku

  • #78556

    Kevyn
    Participant

    Not sure how the URL got changed/warped in that last post and why I can't edit my post, but here it is again.

    http://mctexpert.blogspot.com/2014/12/list-impact-level-of-all-powershell.html

You must be logged in to reply to this topic.