Hello Everyone -
I have two modules(functions) that i've written and tested successfully locally in my environment that give me Uninstall and Repair functionality on whatever the string contains. Both .psm1's are delivered via a SCCM pkg that lands both into folders in the Modules directory. My issue is I can't seem to invoke this in a deployment scenario...as i'd like to deliver the "Invoke-command" using SCCM's command line to simply say...
Invoke-Command -scriptblock { Do-This "<string>" }
The above command works fine locally when...(exePol is set to Bypass).
1.)Modules have respective folders living in WindowsPowershell\Modules directory named xxxx.psm1
2.)Import-Module -name <path\name of module>
3.)Verify Modules are loaded(moduleType is script)
But when fabricating the folders\files above with SCCM, and running the Invoke-Command(in many different ways remotely), i recieve the cmdlet, program doesn't exist and has no idea what i'm talking about. Folders\Files for .psm1's are present and do show when running Get-Module -Listavailable locally on targeted clients.
Maybe this is related to the Import-Module command and the context i'm trying to delivery it in?
I've tried multiple scenario's of...
A.) Psexec that launches powershell, followed by the Import-Module -name <path\name of module>
B.) .Bat file that launches powershell with the same Import-Module syntax
C.) PS1 that includes the same Import-Module line.
D.) Just straight from the command line of the Pkg/Program.
Has anyone tried this? Is there a better method when trying to deliver invoke-command on a module/function to a client via SCCM?
TIA