Re: How to load a new Module in WFA

‎2013-05-0607:41 AM

The approach that you are trying works but there is one difference between how it is imported via the command line and when the profile.ps1 is read. I have tested this in my lab and found that in the latter, there is no Alias created. Get-Ace is actually an alias for Get-Access. I noticed this in the PS1 file that is included in the package. (New-Alias -Name Get-Ace -Value Get-Access). It turns out that the module will import with no issues (as long as the path and ALL of the included files are there. Don't leave any of them out). After running the WFA profile.ps1 from the CLI. I got the same exact error as you. This is when I decided to try the real cmdlet name and it worked. I tried to manually add the New-Alias command to the profile.ps1 and that didn't work.

It looks like there are only a couple of aliases that would be created so it might not be that big of an issue. I can't figure out why it is not setting up the Aliases. What I found odd was when I manually added the below lines to the profile.ps1, I received an error that the Alias already exists but Get-Alias doesn't show those.

New-Alias -Name Get-Ace -Value Get-Access

New-Alias -Name Add-Ace -Value Add-Access

New-Alias -Name Remove-Ace -Value Remove-Access

New-Alias -Name Get-OrphanedAce -Value Get-OrphanedAccess

Anyway, I can confirm that things worked. I added the Import-Module to the WFA profile.ps1 and then restarted the service. I created a new test Command with a very simple script: