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.
Locked
User avatar
tirwin@iot.in.gov
Posts: 40
Joined: Mon Oct 19, 2015 5:45 am

Deployment

Post by tirwin@iot.in.gov » Thu Mar 17, 2016 6:07 am

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 2387 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 2387 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: 7106
Joined: Tue May 29, 2007 4:43 pm

Re: Deployment

Post by Alexander Riedel » Thu Mar 17, 2016 10:42 am

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
Joined: Mon Oct 19, 2015 5:45 am

Re: Deployment

Post by tirwin@iot.in.gov » Thu Mar 17, 2016 11:43 am

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: 13915
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Deployment

Post by jvierra » Thu Mar 17, 2016 1:29 pm

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: 7106
Joined: Tue May 29, 2007 4:43 pm

Re: Deployment

Post by Alexander Riedel » Thu Mar 17, 2016 1:33 pm

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
Joined: Mon Oct 19, 2015 5:45 am

Re: Deployment

Post by tirwin@iot.in.gov » Fri Mar 18, 2016 5:10 am

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 63 times

jvierra
Posts: 13915
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Deployment

Post by jvierra » Fri Mar 18, 2016 6:48 am

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: 13915
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Deployment

Post by jvierra » Fri Mar 18, 2016 9:43 am

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: 13915
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Deployment

Post by jvierra » Sat Mar 19, 2016 4:05 am

The following is what is causing your program to quit:

[Environment]::Exit(1)


This will always exit the program:
  1. $btnSubmit_Click = {
  2.  
  3.     $company = $comboboxOrganizationalUnitRestore.Text
  4.  
  5.     $departmentNumber = $txtBillingCodeRestore.Text
  6.  
  7.     $accountType = $comboboxAccountTypeRestore.Text
  8.  
  9.    
  10.  
  11.     if ($accountType -eq "Seat"){
  12.  
  13.         $accountType = " "
  14.  
  15.     }
  16.  
  17.     $deletme = "DELETEME"
  18.  
  19.     $pcr = "PCR"
  20.  
  21.     $seat = "Seat"
  22.  
  23.    
  24.  
  25.     $global:oldComputerObject.company = $deletme
  26.  
  27.     $global:oldComputerObject.departmentNumber = $pcr
  28.  
  29.     $global:oldComputerObject.extensionAttribute15 = $seat
  30.  
  31.    
  32.  
  33.     $global:newComputerObject.company = $company
  34.  
  35.     $global:newComputerObject.departmentNumber = $departmentNumber
  36.  
  37.     $global:newComputerObject.extensionAttribute15 = $accountType
  38.  
  39.    
  40.  
  41.     try{
  42.  
  43.         $global:oldComputerObject.SetInfo()
  44.  
  45.         $global:newComputerObject.SetInfo()
  46.  
  47.        
  48.  
  49.         $D = dsmod computer $oldDistinguishedName -disabled yes
  50.  
  51.                
  52.  
  53.         $altRestoreLocation = $txtPath.Text
  54.  
  55.        
  56.  
  57.         if ($altRestoreLocation.Length -eq 0){
  58.  
  59.             $A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat \\iotisip01pa\usmtbackups$\$global:oldComputerName -Wait -passthru
  60.  
  61.             $a.ExitCode
  62.  
  63. .       }else{
  64.  
  65.             $A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat $altRestoreLocation -Wait -passthru;
  66.  
  67.             $a.ExitCode
  68.  
  69.         }
  70.  
  71.        
  72.  
  73.         $RestoreForm.Close()
  74.  
  75. ++++++++++++++++++++++++++++++++++++++++++++++++
  76.  
  77. +++++++++++++++++++++++++++++++++++++++++++++++
  78.  
  79.         [Environment]::Exit(1)             <<<<============ Remove this.
  80.  
  81. ++++++++++++++++++++++++++++++++++++++++++++++++
  82.  
  83. ++++++++++++++++++++++++++++++++++++++++++++++++
  84.  
  85.     }
  86.  
  87.     catch{
  88.  
  89.         $labelDialogRedRestore.Text = “AD computer object not found”
  90.  
  91.     }
  92.  
  93. }
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

Locked