Hi, I’m trying to import a powershell module and run a powershell script from a BigFix action script. But the import module part isn’t working. I currently have the module on a network share that runs fine if I run it manually from any server on our network. And, if I import the module using c:>Import-Module \file1\systems\modules\UserRights and then run the BigFix task against that server, the file runs and the local security policy gets changed to how we want it. But importing the module from within the Bigfix actions script isn’t working.
This is what I’m trying to do. Any help or suggestions would be greatly appreciated it.
// Disable wow64 redirection on x64 OSes
action uses wow64 redirection {not x64 of operating system}
delete __createfile
createfile until EOF_EOF_EOF
Import-module \file1\systems\scripts\modules\UserRights
$service = Get-UserRightsGrantedToAccount -account AD_LocalSecurity_LogOnAsAService
$batch = Get-UserRightsGrantedToAccount -account AD_LocalSecurity_LogOnAsBatch
Check to see if 1. AD_LocalSecurity_LogOnAsAService has any rights assigned to it and
2. If it specifically has the SeServiceLogonRight assigned to it.
if (!$service -or “SeServiceLogonRight” -notin $service.right)
{
## Assign the “Log on as a service” right.
grant-userright -right SeServiceLogonRight -account AD_LocalSecurity_LogOnAsAService
}
Check to see if 1. AD_LocalSecurity_LogOnAsBatch has any rights assigned to it and
2. If it specifically has the SeBatchLogonRight assigned to it.
if (!$batch -or “SeBatchLogonRight” -notin $batch.right)
{
grant-userright -right SeBatchLogonRight -account AD_LocalSecurity_LogOnAsBatch
}
EOF_EOF_EOF
delete "c:\javelin.ps1"
copy __createfile “c:\javelin.ps1”
waithidden C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file “C:\javelin.ps1”