• /r/powershell
  • Commands from required modules being reported as in my module

    I have a module that I’ve written that uses the ActiveDirectory module for some of its operations. It lists the ActiveDirectory module in the .psd1 file in both RequiredModules and PSData/ExternalModuleDependencies (for when it’s published to an internal repository). When I Import-Module <myModuleName> then do a Get-Command -Module <myModuleName> it lists all the ActiveDirectory cmdlets […]

  • /r/powershell
  • refactoring parameter to DynamicParam

    This is my first attempt at working with DynamicParam(primarily for an autocomplete functionality) and I am getting a bit lost. I am trying to make the param be bound to the code: Get-ChildItem -filter *-* | ?{$_.PSIsContainer } | %{($_.Name.split(‘-‘))[1]} | Sort-Object My parameter block is (based on https://foxdeploy.com/2017/01/13/adding-tab-completion-to-your-powershell-functions/ ) Param([parameter()] [String] $TicketDir = (Get-Location).Path, […]

  • /r/powershell
  • A Powershell Menu System

    I had the need to write a menu system to make it easier for Jr. level admins to carry out some system admin related tasks. Here is a copy of these scripts. This system also makes use of my Write-Color system I posted here a month or so ago. ################################################################################################### # Powershell Menu System # […]