Product, version and build: PowerShell Studio 2018 v5.5.152
32 or 64 bit version of product: 64 bit
Operating system: Windows 10 (1803)
32 or 64 bit OS: 64 bit
*** Please add details and screenshots as needed below. ***
In the Object Browser panel, i have selected a database I configured in Primal SQL.
from there I select a table, right click "Generate Query PowerShell Script..."
Select a name,
Save
When the script opens and I attempt to run it I get the following error
>> Running (Get-Query_Postgre_public_Users.ps1) Script...
>> Platform: V5 64Bit (STA)
>> Analyzing Script (Results in Debug pane)...
ERROR: Add-Type : Cannot add type. The assembly 'Npgsql, Version=2.0.13.91, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' could not be found.
Get-Query_Postgre_public_Users.ps1 (9, 1): ERROR: At Line: 9 char: 1
ERROR: + Add-Type -AssemblyName 'Npgsql, Version=2.0.13.91, Culture=neutral, P ...
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : ObjectNotFound: (Npgsql, Version...d8b90d52f46fda7:String) [Add-Type], Exception
ERROR: + FullyQualifiedErrorId : ASSEMBLY_NOT_FOUND,Microsoft.PowerShell.Commands.AddTypeCommand
ERROR:
ERROR: Add-Type : Cannot add type. One or more required assemblies are missing.
Get-Query_Postgre_public_Users.ps1 (9, 1): ERROR: At Line: 9 char: 1
ERROR: + Add-Type -AssemblyName 'Npgsql, Version=2.0.13.91, Culture=neutral, P ...
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException
ERROR: + FullyQualifiedErrorId : ASSEMBLY_LOAD_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand
ERROR:
ERROR: New-Object : Cannot find type [Npgsql.NpgsqlCommand]: verify that the assembly containing this type is loaded.
Get-Query_Postgre_public_Users.ps1 (15, 12): ERROR: At Line: 15 char: 12
ERROR: + $command = New-Object Npgsql.NpgsqlCommand ($QueryString, $Connection ...
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
ERROR: + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
ERROR:
ERROR: New-Object : Cannot find type [Npgsql.NpgsqlDataAdapter]: verify that the assembly containing this type is loaded.
Get-Query_Postgre_public_Users.ps1 (16, 12): ERROR: At Line: 16 char: 12
ERROR: + $adapter = New-Object Npgsql.NpgsqlDataAdapter ($command)
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
ERROR: + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
ERROR:
ERROR: You cannot call a method on a null-valued expression.
Get-Query_Postgre_public_Users.ps1 (20, 1): ERROR: At Line: 20 char: 1
ERROR: + [void]$adapter.Fill($dataset)
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidOperation: (:) [], RuntimeException
ERROR: + FullyQualifiedErrorId : InvokeMethodOnNull
ERROR:
*** PowerShell Script finished. ***
>> Execution time: < 1 second
>> Script Ended
Error - Generate Query PowerShell Script
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
Re: Error - Generate Query PowerShell Script
The script requires the Postgre .NET provider to run. You can find the dll in PowerShell Studio's installation directory:
C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2018\Npgsql.dll
I recommend add it to the Global Assembly Cache so that PowerShell can locate it.
C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2018\Npgsql.dll
I recommend add it to the Global Assembly Cache so that PowerShell can locate it.
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.