Deploy Powershell Script As An Application Install Question
I want to create an application (not packages) to run a powershell script to install a software. In this script it installs software and copies files over to different directories. Is there a way to do this in Applications? Currently I've been creating task sequences to accomplish this which does work but I was wondering if this could be done thru applications or maybe if there is some better idea of doing this. Any advice would be grateful. Thanks in advance.
May 1st, 2014 1:49pm

>Is there a way to do this in Applications?

Yes, the application model runs a command against your source content.  In your example, the command would run your powershell script.

Nash

Free Windows Admin Tool Kit Click here and download it now
May 1st, 2014 1:55pm

Thanks Nash. I got my script to run but it doesn't install the software. I can run it manually from the ccmcache folder and it'll install the software but when running the "install.ps1" file from SCCM it doesn't install the software but does copy files to the directory specified. Why would it work one way and not the other? Any ideas?

$CurrentDirectory = Split-Path $MyInvocation.MyCommand.Definition -Parent -Resolve
Start-Process -Filepath "msiexec.exe" -ArgumentList /i, "Sharegate.Migration.4.6.1.msi", /q -Wait


if ( Get-WmiObject -Class Win32_OperatingSystem | Where-Object { $_.version -match '6.' } )
{ md 'C:\ProgramData\ShareGate' -Force
Copy-Item -Path "$CurrentDirectory\Sharegate.License.xml" -Destination 'C:\ProgramData\ShareGate' -Force
}
else
{
if ( Get-WmiObject -Class Win32_OperatingSystem | Where-Object { $_.version -match '5.' } )
{
md 'C:\Documents and Settings\All Users\Application Data\ShareGate' -Force
Copy-Item -Path "$CurrentDirectory\Sharegate.License.xml" -Destination 'C:\Documents and Settings\All Users\Application Data\ShareGate' -Force
}
}


May 5th, 2014 1:38pm

You create a variable for the current directory, but you only use it for the copy action. Why not for the installation action?
Free Windows Admin Tool Kit Click here and download it now
May 5th, 2014 1:46pm

Sorry I was modifying the script and accidently took it out. the second line actually looks like this

Start-Process -Filepath "msiexec.exe" -ArgumentList /i, "Sharegate.Migration.4.6.1.msi", /q -Wait -WorkingDirectory $CurrentDirectory


May 5th, 2014 1:52pm

Hi,

Any updates?

If this problem has not been resolved, please check AppIntentEval.log and AppEnforce.log to see whether there are some helpful information.  

" I can run it manually from the ccmcache folder and it'll install the software but when running the "install.ps1" file from SCCM it doesn't install the software but does copy files to the directory specified."

Could this be related to the account running the script? How about running as system account?

Best Regards,

Joyce

Free Windows Admin Tool Kit Click here and download it now
May 8th, 2014 2:23am

Joyce,

I do remember looking at the AppEnforce.log and did not see any errors. I did not check the AppIntentEval.log but will do that hopefully sometime this week. As for the account, all domain users are local admins. I also tried changing line 2 to what I have below here (running non-silent)and I get the same results. It's almost like it skipped this line and moved on to the next. What else can I try to troubleshoot this? Thanks for your help Joyce.

Start-Process -Filepath "msiexec.exe" -ArgumentList /i, "Sharegate.Migration.4.6.1.msi" -Wait -WorkingDirectory $CurrentDirectory



  • Edited by Pa Chou Tuesday, May 13, 2014 7:57 PM
May 13th, 2014 10:52pm

After several trial and errors I added "/l*v c:\sharegate.log" as part of the msi install and saw a bunch lines like this "SOURCEMGMT: Source is invalid due to missing/inaccessible package." It searched in several folders under the ccmcache folder and then eventually quit because it couldn't find it. It was searching for folders that didn't even exist and didn't even search for the folder it did exist in. Anyways I got it to finally work. I downloaded the latest version of sharegate and its now working. I don't know if it was a SCCM issue or sharegate installer issue but it is now working. Thanks for taking your time to help me.
Free Windows Admin Tool Kit Click here and download it now
May 15th, 2014 12:50pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics