Page 1 of 1

Error importing the DellBIOSProvider module from executable

Posted: Thu Feb 23, 2017 8:23 am
by rg2017
Product, version and build: 5.4.135
(*** Please do not write "latest" as a version, specify a version number ***)
32 or 64 bit version of product: 64 bit
Operating system: Windows 10
32 or 64 bit OS: 64 bit
PowerShell Version: 5

Hi!,
I am getting an error when executing package created in PowerShell Studio.
I am trying to load the DellBIOSProvider (https://www.powershellgallery.com/packa ... ovider/1.0), but it fails to import with the following erros/messages:

ERROR: http://go.microsoft.com/fwlink/?LinkID=135170.
ERROR: At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\DellBIOSProvider\DellBIOS
ERROR: Provider.psm1:1 char:2
ERROR: + .$psScriptRoot\Set-Dell1stBootdevice.ps1
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecord
ERROR: Exception
ERROR: + FullyQualifiedErrorId : UnauthorizedAccess
ERROR: Import-Module : The module to process 'DellBIOSProvider.psm1', listed in field
ERROR: 'NestedModules' of module manifest 'C:\Windows\system32\WindowsPowerShell\v1.0\
ERROR: Modules\DellBIOSProvider\DellBIOSProvider.psd1' was not processed because no
ERROR: valid module was found in any module directory.
ERROR: At line:22 char:2
ERROR: + Import-Module DellBIOSProvider
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : ResourceUnavailable: (DellBIOSProvider:String) [
ERROR: Import-Module], PSInvalidOperationException
ERROR: + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.
ERROR: Commands.ImportModuleCommand
ERROR:

Re: Error importing the DellBIOSProvider module from executable

Posted: Thu Feb 23, 2017 9:57 am
by DevinL
How exactly do you attempt to import the module? Is it possible you could provide us with the script that's causing this?

Also, can you verify that the module is indeed installed at C:\Windows\system32\WindowsPowerShell\v1.0\Modules\DellBIOSProvider\?

Re: Error importing the DellBIOSProvider module from executable

Posted: Thu Feb 23, 2017 11:45 am
by rg2017
Devin,

Yes, the module is there. If you use regular Powershell script, then it is fine, but if you use the build option in PowerShell Studio to create an executable, then you get the error message that I posted.
I have attache a screenshot showing the module is there.

One thing that I noticed on the error message from the executable is that this "cannot be loaded because running scripts is disabled". It is my understanding that running the executable from memory doesn't require a change to the execution policy. Can this be part of the issue?



This is test script:

<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.135
Created on: 2/23/2017 9:57 AM
Created by:
Organization:
Filename:
===========================================================================
.DESCRIPTION
A description of the file.
#>

<#
For more information on the try, catch and finally keywords, see:
Get-Help about_try_catch_finally
#>

# Try one or more commands
try {
#Import Dell BIOSProvider
Import-Module DellBIOSProvider
Write-Host "Module loaded"
}
# Catch specific types of exceptions thrown by one of those commands
catch [System.Exception] {
Write-Host "Module not loaded"
}
# Catch all other exceptions thrown by one of those commands
catch {
}

Re: Error importing the DellBIOSProvider module from executable

Posted: Thu Feb 23, 2017 12:25 pm
by DevinL
Yes, running the script in the executable doesn't require the execution policy to be modified, however since it calls the script at $psScriptRoot\Set-Dell1stBootDevice.ps1, that does require the execution policy be modified.

Since it's only the exe causing problems and everything else seems to be working fine, this is most likely a permission issue. I noticed you're running the executable as administrator, how exactly did you get your exe to run this way? We have an article here you may find of interest: https://www.sapien.com/blog/2017/01/19/ ... nistrator/

Re: Error importing the DellBIOSProvider module from executable

Posted: Thu Feb 23, 2017 2:16 pm
by rg2017
Devin,

Yes, I am using the manifest with elevation when creating the executable.

IS there a way to include a change of execution policy in the executable? Also How can I get the USA AES 256 version of the packaging tool?

Thanks

Re: Error importing the DellBIOSProvider module from executable

Posted: Thu Feb 23, 2017 3:21 pm
by DevinL
This is indeed possible, I highly recommend a search for "PowerShell Execution Policy Registry".

Re: Error importing the DellBIOSProvider module from executable

Posted: Thu Feb 23, 2017 3:22 pm
by Alexander Riedel
Please contact sales@sapien.com about the high encryption pack.