I copied and pasted the code from a previous entry in this thread so it is the same code.
Debugger shows nothing
the script DOES work as a standalone in ISE, irrespective of what the variable name is the script executes on an OU, as long as an OU name is entered by the user.
t's ok, I'll find another way to do this.
Script works fine in Powershell/ISE but not in PrimalForms.
Forum rules
Do not post any licensing information in this forum.
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 any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Script works fine in Powershell/ISE but not in PrimalFor
There is no OU involved in this code you posted:
THe format of that identity is just wrong. I haveQuest and have tested it. It is a bad syntax.
I keep asking for the PFF file and I can test it completely. If you cannot see or understand the issue I ma posting about then I cannot be of much help.
Sorry.
PowerShell Code
Double-click the code block to select all.$resultsbox.Text=Get-QADObject domain.com/$UserEntryTextBox.Text -SecurityMask Dacl | Get-QADPermission -UseExtendedMatch -Inherited -SchemaDefault -Property ('name') | Out-String $ResultsBox.Focus()You cannot use "$UserEntryTextBox.Text " in the ISE. It will not work. It is only valid in a form.
THe format of that identity is just wrong. I haveQuest and have tested it. It is a bad syntax.
I keep asking for the PFF file and I can test it completely. If you cannot see or understand the issue I ma posting about then I cannot be of much help.
Sorry.
Re: Script works fine in Powershell/ISE but not in PrimalFor
The OU is what the user enters in the text box, that's why the code uses the variable $userentrybox. The path is domainname/variable. As long as the OU is entered there it is supposed to look at the permissions set on that OU.
Again, this works when not in a form, as soon as it is included in the primalforms code it stops working and that is my problem.
To break it down, the user enters the name of an OU, this is prefixed in the code by the domain name and the script looks up the permissions set on the OU the user entered the name of. It then, when not in the form, displays the permissions set on the OU, all users, all groups with inherited or explicit permissions set on the OU are listed, the permissions they have are listed and whether it is inherited or not is displayed.
The code works fine until it is put into the form, when I try to run this in the form it does nothing. If it was looking for a user ID and an OU was entered it would say there was a problem, it couldn't find the object listed. It does not do this.
I have posted 2 versions of the same script, the only differences are one is a standalone, no variables needed, this works perfectly, the second version includes variables because that's the idea of using a form, allow users to pick which OU they want details of. the actual script itself is the same, just where it gets it's search criteria from and where to display it are different.
Again, this works when not in a form, as soon as it is included in the primalforms code it stops working and that is my problem.
To break it down, the user enters the name of an OU, this is prefixed in the code by the domain name and the script looks up the permissions set on the OU the user entered the name of. It then, when not in the form, displays the permissions set on the OU, all users, all groups with inherited or explicit permissions set on the OU are listed, the permissions they have are listed and whether it is inherited or not is displayed.
The code works fine until it is put into the form, when I try to run this in the form it does nothing. If it was looking for a user ID and an OU was entered it would say there was a problem, it couldn't find the object listed. It does not do this.
I have posted 2 versions of the same script, the only differences are one is a standalone, no variables needed, this works perfectly, the second version includes variables because that's the idea of using a form, allow users to pick which OU they want details of. the actual script itself is the same, just where it gets it's search criteria from and where to display it are different.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Script works fine in Powershell/ISE but not in PrimalFor
Run your script in powershell -noprofile first
Usually in these cases you have a dependency on a profile.
Please note that this particular forum is for scripting questions and NOT product support questions.
Usually in these cases you have a dependency on a profile.
Please note that this particular forum is for scripting questions and NOT product support questions.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Script works fine in Powershell/ISE but not in PrimalFor
For an OU with Get-ADObject this will work
$oupath="domain.com/$($textbox.Text)"
Note that you must use the subexpression evaluation operator. This will not work for userids and the supplied canonical path must be the complete path to the object.
$oupath="domain.com/$($textbox.Text)"
Note that you must use the subexpression evaluation operator. This will not work for userids and the supplied canonical path must be the complete path to the object.
Re: Script works fine in Powershell/ISE but not in PrimalFor
it works fine for me with Quest using the last method I posted which guarantees proper evaluation of the textbox properties.
I will build a very simple demo in a few minutes if I have time.
I will build a very simple demo in a few minutes if I have time.
Re: Script works fine in Powershell/ISE but not in PrimalFor
Here is what I used and it works as expected:
PowerShell Code
Double-click the code block to select all.$button1_Click={ #TODO: Place custom script here $textbox2.text=Get-QADObject "test.local/$($textbox1.Text)" |fl | Out-String }
Re: Script works fine in Powershell/ISE but not in PrimalFor
thank you, that works, I was missing the (see bold characters) "domain/$(variable)"
Sorry to have caused confusion.
Sorry to have caused confusion.
Re: Script works fine in Powershell/ISE but not in PrimalFor
Yeah! That is one of the things I was trying to get you to address. To bad we kept having issues with the web site and with which code was at issue.
This is a basic PowerShell issue. Whenever we "stringify" a variable the variable needs to be evaluated as a value type and not an object property.
The issue has nothing to do with FOrms or ISE or Sapien. It is a basic issue of PowerShell.
Example:
Here is a useful post: http://mcpmag.com/articles/2012/10/02/p ... ables.aspx
This is a basic PowerShell issue. Whenever we "stringify" a variable the variable needs to be evaluated as a value type and not an object property.
The issue has nothing to do with FOrms or ISE or Sapien. It is a basic issue of PowerShell.
Example:
PowerShell Code
Double-click the code block to select all.PS C:\scripts> $item=get-service browser PS C:\scripts> $item.name browser PS C:\scripts> "$item.name" System.ServiceProcess.ServiceController.name PS C:\scripts> "$($item.name)" browser PS C:\scripts>Note what happens if we do not use "subexpression evaluation"
Here is a useful post: http://mcpmag.com/articles/2012/10/02/p ... ables.aspx