import-module -VERBOSE

Welcome Forums General PowerShell Q&A import-module -VERBOSE

Viewing 0 reply threads
  • Author
    Posts
    • #34864
      Participant
      Topics: 2
      Replies: 0
      Points: -12
      Rank: Member

      I built a module file (.psm1) I wanted to show a few help/info lines if it was imported with the -verbose switch. Wanted to show more that just the stream of new functions. But the verbose argument escapes me inside the psm1 scope? Can I do this?
      import-module SavePuppy -verbose

      `savepuppy.psm1`

      write-verbose "Save a puppy!"
      
      function get-poo
      {
          [CmdletBinding()]   Param ()
          Process    {
              Write-Verbose "Puppy Saved"
          }
      }
      
      if ($PSBoundParameters['Verbose'] -eq $True) { 
          write-host "Play Dead"
      }
      write-Host "R.I.P fido"
      
      
Viewing 0 reply threads
  • The topic ‘import-module -VERBOSE’ is closed to new replies.