Deployment

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
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.
This topic is 8 years and 1 week old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
tirwin@iot.in.gov
Posts: 40
Last visit: Tue Mar 14, 2017 9:54 am

Deployment

Post by tirwin@iot.in.gov »

I have a application for PC Refresh. Which is run from server as administrator. I had Deployed a 32 & 64 bit version and things seemed to be working fine. However they changed to server where the Backups would be stored. So I changed all the relevant file paths in my app and Deployed my app. The problem is on a Restore the app exits without executing the following line.
$A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat \\iotisip01pa.state.in.us\usmtbackups$\$newComputer -Wait -passthru;
$a.ExitCode
Finally after many atempts to Deploy I got the 64 Bit version to work using the following Settings.
sapien 1.PNG
sapien 1.PNG (37.84 KiB) Viewed 3800 times
This does create an xml config file that seems to be necessary, which is strange because my previous deployment worked fine without that. My problem is I am unable to use this same operation to create the 32 Bit app. Nothing I have tried seems to work. Here are the 32 Bit Settings.
sapien 2.PNG
sapien 2.PNG (38.33 KiB) Viewed 3800 times
I do not understand this strange behavior or even if I am Deploying the right way. This is not an app I want installed on a Computer. The Tech will just right click the app and run as Administrator from the server share. Can someone help?
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Deployment

Post by Alexander Riedel »

I have moved this another forum that is more appropriate for your question. Since there is no license associated with your user id I cannot move this to the product support forum. You will need to provide more details, like server version, why you are using V2 and actual error messages.
First and foremost you need to check that the script itself actually operates in your environment.

Please read: https://www.sapien.com/blog/2015/11/09/ ... t-request/
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
tirwin@iot.in.gov
Posts: 40
Last visit: Tue Mar 14, 2017 9:54 am

Re: Deployment

Post by tirwin@iot.in.gov »

Thank you sir, I bought a license about 6 months ago. I dont know why there is no license associated with my ID. I would post my licensing info except the dialog just above says "Do not post any licensing information in this forum.". I have created an App that was developed using SAPIEN Powershell Studio 2015. There are no errors inthe APP. It runs perfectly in my Development Environment. In fact I had a 32 bit and 64 bit version working with the proper file paths to another server where those back ups are stored. I changed the backups file paths to point them to another server and recompiled to the same server. However, the 64 Bit version works and the 32 Bit version DOES NOT. My question is about the Script Packager Engine Settings. The 32 Bit App does run however it does not execute The loadstate cmd as mentioned above. It is the same code as the 64 Bit version that works fine. The Server is a EMC ISILON, Version IFS.

Question:
If I have an App that works in the ISE with no Error's. How should I package it so I can run it from the Server (RghtClick)>(Run as Administrator)?
Because I would think that a 32 Bit package should run on both 64 Bit and 32 Bit machines. That has not been my experience here, so if you could answer that question that might be my problem as well?

Again I have checked many times the file path associated with the loadstate and it works fine. It is the same app as the 64 Bit only Compiled to a 32 Bit Version. Also I have compiled to Platform: SAPIEN Powershell V2 Host (Windows Forms) Win32 because it is the only Platform where the APP will even open (I have tried all the others). Can you please give advice?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Deployment

Post by jvierra »

Without a copy of your PFF file it is not possible to even guess at what issues you are seeing. What errors ,are you getting?
We cannot guess at how the line in question can be skipped without a copy of your PFF file. You can attach the file or zipped project to your post.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Deployment

Post by Alexander Riedel »

Please email your license information to support@sapien.com and we see who this is registered to.

Without having access to your machines, your script and its configuration it is virtually impossible to say for certain what is wrong.
Generally many folders and registry branches are mapped, so even if they have the same name they point to physically different locations when executed under different platforms. Additionally permission issues can play a role here.

The ISE you are running on a 64 bit machine is 64 bit and it runs elevated. It is, unless you have an old machine, most certainly NOT V2.
Using $psversiontable will tell you exactly what it is. Basically you need to use the same platform and version as you have on your machine and select elevation in order to run the same way as the ISE does.

"it does not execute The loadstate cmd": This is not sufficient information to diagnose that problem. Does it not run it because it never reaches this statement? Does it spit out an error that the file does not exist? If you package with a Windows forms engine, you are suppressing standard output and you need to add that information to your form output. I do not know if your script is a Windows form script or not, so I cannot guess as to what you need to do. Does it run the batch file but the content of the batch file is not executed?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
tirwin@iot.in.gov
Posts: 40
Last visit: Tue Mar 14, 2017 9:54 am

Re: Deployment

Post by tirwin@iot.in.gov »

Thanks for your help. I have attached the entire project in a zip file. Again I show no errors in my ISE. Inside Project Files Folder are 2 Folders. 1 with all the psf files for the project. 1 with a ps1 file (takes the place of AD Module) because this is intended to run on newly imaged machines without AD Module installed. Obviously you will need to update the path to this ps1 file. Also will need to update any paths to AD Domain ext.

The Form that is the problem is "RestoreForm.psf ( The first dropdown select all the Backup Up Computers on a server). The rest of the inputs on the form set the attributes of the new or client machine the App is running on). The program exits the following block of code without running but only on a 32 Bit system.

if ($altRestoreLocation.Length -eq 0)
{
$A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat \\iotisip01pa\usmtbackups$\$global:oldComputerName -Wait -passthru; $a.ExitCode
. }
else
{
$A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat $altRestoreLocation -Wait -passthru;
$a.ExitCode
}

Thanks again for your help
Attachments
Project Files.zip
Project Files
(333.91 KiB) Downloaded 148 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Deployment

Post by jvierra »

Hi tirwin. I will look at this later today.
One item I see is the profile. You should not create a project with profile dependencies. Move all required elements into the project. I can't say this is the problem as I have not looked closely at the files.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Deployment

Post by jvierra »

Sorry but we need the whole project folder including the control files or the project cannot be loaded.

We also need to know which event is calling the code that causes the program to exit.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Deployment

Post by jvierra »

The following is what is causing your program to quit:

[Environment]::Exit(1)


This will always exit the program:
  1. $btnSubmit_Click = {
  2.     $company = $comboboxOrganizationalUnitRestore.Text
  3.     $departmentNumber = $txtBillingCodeRestore.Text
  4.     $accountType = $comboboxAccountTypeRestore.Text
  5.    
  6.     if ($accountType -eq "Seat"){
  7.         $accountType = " "
  8.     }
  9.     $deletme = "DELETEME"
  10.     $pcr = "PCR"
  11.     $seat = "Seat"
  12.    
  13.     $global:oldComputerObject.company = $deletme
  14.     $global:oldComputerObject.departmentNumber = $pcr
  15.     $global:oldComputerObject.extensionAttribute15 = $seat
  16.    
  17.     $global:newComputerObject.company = $company
  18.     $global:newComputerObject.departmentNumber = $departmentNumber
  19.     $global:newComputerObject.extensionAttribute15 = $accountType
  20.    
  21.     try{
  22.         $global:oldComputerObject.SetInfo()
  23.         $global:newComputerObject.SetInfo()
  24.        
  25.         $D = dsmod computer $oldDistinguishedName -disabled yes
  26.                
  27.         $altRestoreLocation = $txtPath.Text
  28.        
  29.         if ($altRestoreLocation.Length -eq 0){
  30.             $A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat \\iotisip01pa\usmtbackups$\$global:oldComputerName -Wait -passthru
  31.             $a.ExitCode
  32. .       }else{
  33.             $A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat $altRestoreLocation -Wait -passthru;
  34.             $a.ExitCode
  35.         }
  36.        
  37.         $RestoreForm.Close()
  38. ++++++++++++++++++++++++++++++++++++++++++++++++
  39. +++++++++++++++++++++++++++++++++++++++++++++++
  40.         [Environment]::Exit(1)             <<<<============ Remove this.
  41. ++++++++++++++++++++++++++++++++++++++++++++++++
  42. ++++++++++++++++++++++++++++++++++++++++++++++++
  43.     }
  44.     catch{
  45.         $labelDialogRedRestore.Text = “AD computer object not found”
  46.     }
  47. }
Also note that this line: $labelDialogRedRestore.Text = “AD computer object not found” has "smart quotes". These are all over your forms. This comes from copying code from web pages. This kind of quote will give you all kinds of headaches. You need to remove them everywhere. It is also a good clue that there can be unprintable characters in the files. This is also known to cause issues. Nulls are expecially nasty.

Remove the exit line and if all thins work you are OK but beware of the quotes. Any future edit can cause then to be a problem.

See: http://dan.hersam.com/tools/smart-quotes.html
This topic is 8 years and 1 week old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked