Error importing the DellBIOSProvider module from executable

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
rg2017
Posts: 4
Joined: Wed Jan 04, 2017 6:09 am

Error importing the DellBIOSProvider module from executable

Post by rg2017 » Thu Feb 23, 2017 8:23 am

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:

User avatar
DevinL
Site Admin
Posts: 1098
Joined: Mon Aug 17, 2015 2:25 pm

Re: Error importing the DellBIOSProvider module from executable

Post by DevinL » Thu Feb 23, 2017 9:57 am

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\?
DevinL
SAPIEN Technologies, Inc.

User avatar
rg2017
Posts: 4
Joined: Wed Jan 04, 2017 6:09 am

Re: Error importing the DellBIOSProvider module from executable

Post by rg2017 » Thu Feb 23, 2017 11:45 am

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 {
}
Attachments
DellBIOSProviderError.PNG
DellBIOSProviderError.PNG (120.72 KiB) Viewed 1389 times

User avatar
DevinL
Site Admin
Posts: 1098
Joined: Mon Aug 17, 2015 2:25 pm

Re: Error importing the DellBIOSProvider module from executable

Post by DevinL » Thu Feb 23, 2017 12:25 pm

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/
DevinL
SAPIEN Technologies, Inc.

User avatar
rg2017
Posts: 4
Joined: Wed Jan 04, 2017 6:09 am

Re: Error importing the DellBIOSProvider module from executable

Post by rg2017 » Thu Feb 23, 2017 2:16 pm

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

User avatar
DevinL
Site Admin
Posts: 1098
Joined: Mon Aug 17, 2015 2:25 pm

Re: Error importing the DellBIOSProvider module from executable

Post by DevinL » Thu Feb 23, 2017 3:21 pm

This is indeed possible, I highly recommend a search for "PowerShell Execution Policy Registry".
DevinL
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 6710
Joined: Tue May 29, 2007 4:43 pm

Re: Error importing the DellBIOSProvider module from executable

Post by Alexander Riedel » Thu Feb 23, 2017 3:22 pm

Please contact sales@sapien.com about the high encryption pack.
Alexander Riedel
SAPIEN Technologies, Inc.