Hi everybody ,
i recently bought powershell studio to improve my scripts ( i m also a beginner with powershell )
I tried to import a module like we do in powershell and it works fine ( the import )
The only thing is that when i run one of the command ( that is supposed to make a connection to a website with credentials) , it doesn't work while the command works fine when i send it from powershell ise .....
Does anybody have any idea on where it can come from ??
Since the site is a test environnment at my company , i can t share the credentials .... but i can share the imported module if necessary ....
Product, version and build: PowerShell Studio 2021 5.8.187
Operating system: Windows 2016
PowerShell version(s): powershell 5 powershell 7
ES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
problem import ?
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.
-
- Posts: 8
- Last visit: Tue Feb 01, 2022 2:45 am
problem import ?
- Attachments
-
- NTware.Ufo.PowerShell.ObjectManagement.zip
- (87.08 KiB) Downloaded 91 times
Re: problem import ?
What are errors are you receiving from this command? Have you tried setting a break point on this command and debugging the script?
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
-
- Posts: 8
- Last visit: Tue Feb 01, 2022 2:45 am
Re: problem import ?
Yes , i tried the breakpoints and yes i tried to debug.
It seems to block when i use one of the functions that is called "open-momoconnection" included in the module i posted.
that same command works perfectly fine when i launch it with powershell ise ...
I also tried the '-verbose' parameter without any success.... :-/
It seems to block when i use one of the functions that is called "open-momoconnection" included in the module i posted.
that same command works perfectly fine when i launch it with powershell ise ...
I also tried the '-verbose' parameter without any success.... :-/
-
- Posts: 8
- Last visit: Tue Feb 01, 2022 2:45 am
Re: problem import ?
Another "strange" thing : if i make a ps1 file including the command that causes me a problem and i use :
powershell.exe .\do.ps1
then it works fine ....
powershell.exe .\do.ps1
then it works fine ....
-
- Posts: 8
- Last visit: Tue Feb 01, 2022 2:45 am
Re: problem import ?
When i run this separately :
It Works FINE
When i run the same thing on the event click of a button , it doen't work ... it blocks at the command open-momoconnection
PS : my password has naturally been changed ...
- $TenantDomain = 'training-nfr-cbe-bvandewiele.eu.uniflowonline.com'
- $TenantUserName = 'admin_training-nfr-cbe-bvandewiele@euaduniflow.onmicrosoft.com'
- $PlainPwd = 'MYPASSWORD'
- $SecurePwd = $PlainPwd | ConvertTo-SecureString -AsPlainText -Force
- Import-Module '.\Modules\NTware.Ufo.PowerShell.ObjectManagement.dll' -Verbose
- Open-MomoConnection -TenantDomain $TenantDomain -UserName $TenantUserName -Password $SecurePwd -NonInteractive -Verbose
- [int32]$NBRallusers = (Find-MomoUsers).Count
- Write-Output $NBRallusers
When i run the same thing on the event click of a button , it doen't work ... it blocks at the command open-momoconnection
PS : my password has naturally been changed ...
Re: problem import ?
Please try running your GUI script in STA Mode (Home->Platform):
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
-
- Posts: 8
- Last visit: Tue Feb 01, 2022 2:45 am
Re: problem import ?
Hi ,
thanks for your answer but i already tried ...
when i launch the script by itself :
when i launch it from a click_button :
Kind Regards
Bertrand
thanks for your answer but i already tried ...
when i launch the script by itself :
when i launch it from a click_button :
Kind Regards
Bertrand
Re: problem import ?
Please verify that $buttonTest is subscribed to the to the click event $buttonTest_Click. This can be checked with the designer open from the properties panel's event tab:
Assuming this button is being clicked in the form for this code to run, are $TenantDoman, $TenantUserName, $PlainPwd, $SecurePwd all null?Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
-
- Posts: 8
- Last visit: Tue Feb 01, 2022 2:45 am
Re: problem import ?
hi,
all the variables are defined in the file do.ps1 before the import of the module
like i said previously , when i launch the file separately , it works fine...
and to answer your other question , yes the $buttonTest is subscribed to the to the click event $buttonTest_Click
it s a bit like i can t launch the code on an event ..???
I also tried to put the code directly in the click event ( i had tried to launch the code that is in the file do.ps1 directly on the click-event)
:-/
thank you for your help
all the variables are defined in the file do.ps1 before the import of the module
like i said previously , when i launch the file separately , it works fine...
and to answer your other question , yes the $buttonTest is subscribed to the to the click event $buttonTest_Click
it s a bit like i can t launch the code on an event ..???
I also tried to put the code directly in the click event ( i had tried to launch the code that is in the file do.ps1 directly on the click-event)
:-/
thank you for your help