Page 1 of 1


Posted: 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 \\\usmtbackups$\$newComputer -Wait -passthru;
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 2643 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 2643 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?

Re: Deployment

Posted: Thu Mar 17, 2016 10:42 am
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: ... t-request/

Re: Deployment

Posted: 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.

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?

Re: Deployment

Posted: Thu Mar 17, 2016 1:29 pm
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.

Re: Deployment

Posted: Thu Mar 17, 2016 1:33 pm
by Alexander Riedel
Please email your license information to 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?

Re: Deployment

Posted: 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
. }
$A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat $altRestoreLocation -Wait -passthru;

Thanks again for your help

Re: Deployment

Posted: Fri Mar 18, 2016 6:48 am
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.

Re: Deployment

Posted: Fri Mar 18, 2016 9:43 am
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.

Re: Deployment

Posted: Sat Mar 19, 2016 4:05 am
by jvierra
The following is what is causing your program to quit:


This will always exit the program:
  1. $btnSubmit_Click = {
  3.     $company = $comboboxOrganizationalUnitRestore.Text
  5.     $departmentNumber = $txtBillingCodeRestore.Text
  7.     $accountType = $comboboxAccountTypeRestore.Text
  11.     if ($accountType -eq "Seat"){
  13.         $accountType = " "
  15.     }
  17.     $deletme = "DELETEME"
  19.     $pcr = "PCR"
  21.     $seat = "Seat"
  25.     $ = $deletme
  27.     $global:oldComputerObject.departmentNumber = $pcr
  29.     $global:oldComputerObject.extensionAttribute15 = $seat
  33.     $ = $company
  35.     $global:newComputerObject.departmentNumber = $departmentNumber
  37.     $global:newComputerObject.extensionAttribute15 = $accountType
  41.     try{
  43.         $global:oldComputerObject.SetInfo()
  45.         $global:newComputerObject.SetInfo()
  49.         $D = dsmod computer $oldDistinguishedName -disabled yes
  53.         $altRestoreLocation = $txtPath.Text
  57.         if ($altRestoreLocation.Length -eq 0){
  59.             $A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat \\iotisip01pa\usmtbackups$\$global:oldComputerName -Wait -passthru
  61.             $a.ExitCode
  63. .       }else{
  65.             $A = Start-Process -FilePath \\iotsdsp01pw\installs$\USMTWin10\dependencies\RUN-LOADSTATE.bat $altRestoreLocation -Wait -passthru;
  67.             $a.ExitCode
  69.         }
  73.         $RestoreForm.Close()
  75. ++++++++++++++++++++++++++++++++++++++++++++++++
  77. +++++++++++++++++++++++++++++++++++++++++++++++
  79.         [Environment]::Exit(1)             <<<<============ Remove this.
  81. ++++++++++++++++++++++++++++++++++++++++++++++++
  83. ++++++++++++++++++++++++++++++++++++++++++++++++
  85.     }
  87.     catch{
  89.         $labelDialogRedRestore.Text = “AD computer object not found”
  91.     }
  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.