Open deepjansari-rwe opened 6 months ago
@deepjansari-rwe Thank you for contact us, and I apologize for the delayed response.
New functions, aliases, etc. need to be added to the appropriate *ToExport array in safeguard-ps.psd1, for instance if you add a new function Get-MyNewFunctionName to safeguard-ps.psm1
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @(
# sslhandling.psm1 is just a helper module -- no functions exported
# ps-utilities.psm1 is just a helper module -- no functions exported
# safeguard-ps.psm1
'Connect-Safeguard','Disconnect-Safeguard','Invoke-SafeguardMethod',
'Get-SafeguardAccessTokenStatus','Update-SafeguardAccessToken',
'Get-MyNewFunctionName'
[...]
Hi, I am trying to add function by creating new file in src folder and then installing by install-local.ps1, however the PowerShell module does not identify the new function as cmdlet. I get the message - "The term 'Edit-SafeguardAssetAccountCustom' is not recognized as the name of a cmdlet, function, script file, or operable program." I can see the new source files with function is placed at C:\Users\xxxxx\Documents\WindowsPowerShell\Modules\safeguard-ps\8.0.99999' after running install-local.ps1
Get-SafeguardCommand also does not list my new function. However, when I modify existing function (assets.psm1 -> Edit-SafeguardAssetAccount) then it works fine, and module identify modified function with new parameters etc I always run Remove-Module safeguard-ps and cleanup-local.ps1 before installing new module.
Is there any specific configuration need to be done to register new named functions as powershell cmdlet?