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.

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
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place.

Similar Messages

  • Deploy powershell script - Uninstall Forefront

    Hi
    Im trying to build a powershell script that uninstall Forefront Client and later install SCEP and it also copy the local exclusions from Forefront to insert in SCEP (registry).
    All works fine when Im running the script locally, but when Im deploying it from Altiris DS it halts on Microsoft Forefront Client Security Antimalware Service". Every time, I also have tried to sort them differently but it wont work.
    All I see in the event viewer is a warning:
    "Application 'C:\Program Files\Microsoft Forefront\Client Security\Client\Antimalware\MSASCui.exe' (pid 1964) cannot be restarted - Application SID does not match Conductor SID.."
    And then later an error:
    HRESULT:0x80070643
    Description:Cannot complete the System Center Endpoint Protection installation. An error has prevented the System Center Endpoint Protection setup wizard from completing successfully. Please restart your computer and try again. Error code:0x80070643. Fatal
    error during installation.
    This is the deployment from Altiris:
    powershell.exe -noexit "& 'C:\Temp\ForefrontSCEP.ps1'"
    Does anyone has any clue?
    Cheers!
    **** The script ****
    # Backup Forefront registry data
    Reg export "HKLM\SOFTWARE\Microsoft\Microsoft Forefront" C:\Temp\SCEPClient_New\exclbackup.reg
    # Create new registry item
    new-Item "HKLM:\SOFTWARE\Microsoft\" -Name "Microsoft Antimalware"
    new-Item "HKLM:\SOFTWARE\Microsoft\Microsoft Antimalware\" -Name Exclusions
    # Copy Forefront registry exclusion data to newly created regkey
    Copy-Item "HKLM:\SOFTWARE\Microsoft\Microsoft Forefront\Client Security\1.0\AM\Exclusions" -Destination "HKLM:\SOFTWARE\Microsoft\Microsoft Antimalware\" -Recurs
    # "Uninstall Forefront och MOM"
    # "Uninstall Microsoft MOM"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Operations Manager 2005 Agent"
    $app.Uninstall()
    # "Uninstall Forefront Assessment"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Forefront Client Security State Assessment Service"
    $app.Uninstall()
    # "Uninstall Forefront Antimalware"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Forefront Client Security Antimalware Service"
    $app.Uninstall()
    # Install SCEP with policy
    Start-Process -FilePath C:\Temp\SCEPClient_New\scepinstall.exe -ArgumentList "/s /q /policy C:\Temp\SCEPClient_New\ServerSCEP.xml" -ErrorAction SilentlyContinue

    I finally solved, in two ways.
    For the powershell part:
    I changed the name match against a filter function. So now I can deploy the powershell script just fine.
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Operations Manager 2005 Agent"
    $application = Get-WMIObject Win32_Product -filter "Name='Microsoft Operations Manager 2005 Agent'"
    2nd solution:
    I also created a batch file which worked at my first try. Gotta love the old fashion way :)
    I post it here as well, maybe somebody can get use of it.
    Uninstall Forefront - Install SCEP - Copy local exclusions
    REM Backup Forefront exclusions
    regedit /e C:\Temp\ForefrontExclBackup.reg "HKLM\Software\Microsoft\Microsoft Forefront"
    REM Create SCEP registry keys
    reg add "HKLM\Software\Microsoft\Microsoft Antimalware"
    REM Create SCEP registry keys
    reg add "HKLM\Software\Microsoft\Microsoft Antimalware\Exclusions"
    REM Copy Foreront exclusions to SCEP
    reg copy "HKLM\Software\Microsoft\Microsoft Forefront\Client Security\1.0\AM\Exclusions" "HKLM\Software\Microsoft\Microsoft Antimalware\Exclusions" /s /f
    REM Uninstall Microsoft Forefront Client Security State Assessment Service
    MsiExec.exe /X{E8B56B39-A826-11DB-8C83-0011430C73A4} /qn
    REM Uninstall Microsoft Forefront Client Security Antimalware Service
    MsiExec.exe /X{436028CD-6476-4224-9274-8F0320F30FD1} /qn
    REM Uninstall Microsoft Operations Manager 2005 Agent
    MsiExec.exe /X{F692770D-0E27-4D3F-8386-F04C6F434040} /qn
    REM Install SCEP and policys
    C:\Temp\SCEPInstall.exe /policy C:\Temp\ServerSCEP.xml /s

  • How to add powershell script code in form application in C#

    Hi,
    i am creating a form application in C# and have powershell code which will create remote session on remote machine and execute few commands like set execution policy copy some share files install that files etc.
    I have to add this powershell script into form application in C#.
    Can some one please give me some example how to add the whole script which i have into C# code form application. Thanks in advance
    Thanks,

    Hi
    So the left is Run PowerShell Commands on Remote machine? Am I right ?
    Here  is a article talking about running  powershell commands on Remote Computers.
    http://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/
    About how to write in C#, please follow
    Joel Engineer's reply, using  process.Start() method  to start
    PowerShell.exe and Run PowerShell Commands to connect remote machine.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error while adding the app in the sharepoint(2013) page through powershell script

    Hi,
        I have created one powershell script to uninstall and install the sharepoint 2013 apps. The code is working fine, but after adding the app in the page I am getting the error "
    Internet Explorer can not display the webpage".
    If I am deploying the app through Visual Studio, its getting deployed successfully and I am getting an option to trust the app.And I am able to add it in the page. But this permission is not coming when I am installing the app using power shell.
    Please let me know whether to do any modifications to the power shell script.
    Thanks.
    Pradeep

    Hi,
       We are using sharepoint hosted app.
    Below is the script to uninstall and install the app.
    cls
    Add-PSSnapin Microsoft.SharePoint.PowerShell –ea SilentlyContinue
    # uninstall the app
    Write-Host "uninstallation of app"
    $InstalledSPApps = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com"
    $appToUninstall = $InstalledSPApps | where {$_.Title -eq 'myCustomSharepointApp'}
    if ($appToUninstall -ne $null)
        Uninstall-SPAppInstance -Identity $appToUninstall ;
        Write-Host "uninstalled successfully"
    # Import-SPAppPackage
    Write-Host "Import the app"
    pause
    $sourceApp = ([microsoft.sharepoint.administration.spappsource]::RemoteObjectModel);
    $myspapp = Import-SPAppPackage -Path "D:\SharePoint 2013\AppsSolution\myCustomSharepointApp.app" -Site "http://mySharepointSite.xyz.com" -Source $sourceApp ;
    Write-Host "Enter to install the app"
    pause
    $app = Install-SPApp -Web "http://mySharepointSite.xyz.com" -Identity $myspapp;
    $AppName = $app.Title;
    Write-Host "app '$AppName' registered"
    pause
    $appInstance = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com" | where-object {$_.Title -eq $AppName};
    $counter = 1;
    $maximum = 150;
    $sleeptime = 2;
    Write-Host -ForegroundColor White "Please wait..." -NoNewline;
    pause
    while (($appInstance.Status -eq ([Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installing)) -and ($counter -lt $maximum))
        Write-Host "." -NoNewline;
        sleep $sleeptime;
        $counter++;
        $appInstance = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com" | where-object {$_.Title -eq $AppName}
    pause
    if ($appInstance.Status -eq [Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installed)
        Write-Host "The App was successfully installed.";
        $appUrl = $appInstance.AppWebFullUrl;
        Write-Host -ForegroundColor White "The App is available at '$appUrl'.";

  • Running PowerShell Script to automate the installation of IIS feature - Add-WindowsFeature error, help please

    I'm just learning PS scripting and Chef Programming, so I'm sure I'm missing something simple. I'm trying to run a recipe that is using PS as the interpreter. I've ensured I'm running PS in 64 bit with admin privileges, and have Imported the ServerManager
    module. I even added a line to my script to have it run that first, but am still receiving an error in my script. I'm running this on a VM of Server 2008R2
    Script:
    powershell_script 'Install IIS' do
      code "Import-Module ServerManager -passthru"
      code "Add-WindowsFeature Web-Server"
      guard_interpreter :powershell_script
      not_if "(Get-WindowsFeature -Name Web-Server).Installed"
    end
    Error:
    PS C:\Users\Administrator\chef-repo> chef-apply webserver.rb
    Recipe: (chef-apply cookbook)::(chef-apply recipe)
      * powershell_script[Install IIS] action run
        ================================================================================
        Error executing action `run` on resource 'powershell_script[Install IIS]'
        ================================================================================
        Mixlib::ShellOut::ShellCommandFailed
        Expected process to exit with [0], but received '1'
        ---- Begin output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat
    None -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" ----
        STDOUT:
        STDERR: The term 'Add-WindowsFeature' is not recognized as the name of a cmdlet, function, script file, or operable
    program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
        ---- End output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat No
    ne -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" ----
        Ran "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -File "C:/Us
    ers/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" returned 1
        Resource Declaration:
        # In webserver.rb
          1: powershell_script 'Install IIS' do
          2:   code "Import-Module ServerManager -passthru"
          3:   code "Add-WindowsFeature Web-Server"
          4:   guard_interpreter :powershell_script
          5:   not_if "(Get-WindowsFeature -Name Web-Server).Installed"
          6: end
        Compiled Resource:
        # Declared in webserver.rb:1:in `run_chef_recipe'
        powershell_script("Install IIS") do
          action "run"
          retries 0
          retry_delay 2
          guard_interpreter :powershell_script
          command "\"powershell.exe\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -Fi
    le \"C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1\""
          backup 5
          returns 0
          code "Add-WindowsFeature Web-Server"
          interpreter "powershell.exe"
          cookbook_name "(chef-apply cookbook)"
          recipe_name "(chef-apply recipe)"
          not_if "(Get-WindowsFeature -Name Web-Server).Installed"
        end
    [2014-12-24T10:29:56-08:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
    [2014-12-24T10:29:56-08:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: powershell_script[Install IIS] ((chef-apply coo
    kbook)::(chef-apply recipe) line 1) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0
    ], but received '1'
    ---- Begin output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None
     -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" ----
    STDOUT:
    STDERR: The term 'Add-WindowsFeature' is not recognized as the name of a cmdlet, function, script file, or operable prog
    ram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    ---- End output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -
    File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" ----
    Ran "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -File "C:/Users/
    ADMINI~1/AppData/Local/Temp/chef-script20141224-432-mxaa9u.ps1" returned 1

    Hi There,
    We have a application named Microsoft SCOM. That as well requires ISS to be installed. I tried this long back and it worked in powershell. Below is the powershell script i used to install IIS and some specific features from it. Hope it helps in altering
    it and making one of your own script.
    1.  Launch the PowerShell command
    prompt
     Run this command
    Import-Module ServerManager
    3. Press Enter
    4. Run this
    command
    Add-WindowsFeature NET-Framework-Core,Web-Metabase,Web-WMI,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Filtering,Web-Windows-Auth,
    Web-Mgmt-Console –restart
    Gautam.75801

  • How to get deployment time of an J2EE application

    Hi All,
    I am developing J2EE applications on NetWeaver 7.0 and 7.1. In my application, I need to get deployment time of a J2EE application installed in the J2EE engine.
    For NetWeaver 7.1, I found SAP's Java APIs to do that:
          com.sap.engine.services.deploy.server.cache.dpl_info.Applications.get("appName").getMonitorData().getDateOfLastRedeployment();
    But for NetWeaver 7.0, I haven't found any similar stuffs.
    Could you give me any helps for the case of NetWeaver 7.0?
    Thank you very much.
    Viet

    I'm not 100% sure but you may be able to turn on tracing for the Java stack "Deploy" service.
    In Visual Administrator, go to "Global Conf [Server] -> services -> Deploy" change additional_debug_info.
    Then in "Cluster [server x] -> services -> log configurator [locations] -> com -> sap -> engine -> services -> deploy" change the debug level to "Info" or something.
    This should put some additional tracing out to the trace files which can be viewed in the Log Viewer.
    Don't forget to reset the trace level when you're done.

  • MDT application install returns unexpected return code: 16

    Hi, I'm using MDT 2013 (Version: 6.2.5019.0) and deploying Server 2012 R2 Standard.
    The deployment runs fine, but an application install fails. Here is the relevant content from the BDD.LOG file:
    Run Command: \\MDT\Share$\Tools\X64\bddrun.exe robocopy \\MDT\Share$\BuildFiles "C:" /MIR /W:5 /R:3 /LOG \\MDT\Share$\LOGS
    ZTI installing application
    About to run command: \\MDT\Share$\Tools\X64\bddrun.exe robocopy \\MDT\Share$\BuildFiles "C:" /MIR /W:5 /R:3 /LOG \\MDT\Share$\LOGS
    Command has been started (process ID 2896)
    Return code from command = 16
    Application Copy Files 1.0 returned an unexpected return code: 16
    Property InstalledApplications001 is now = {9d0ba76d-96f9-4f4f-a6b8-4b1d0ffd2007}
    ZTIApplications processing completed successfully.
    I've searched for the error code 16 but can't find any results. What does it mean?
    Cheers.

    I think that I may have found the solution. On different site I've found the robocopy exit codes and 16 is listed there as "Robocopy
    did not copy any files.  Check the command line parameters and verify that Robocopy has enough rights to write to the destination folder."
    I guess that I need to alter the destination folder to something other than the root of C:\
    I'll respond with the result later.
    UPDATE: Yep, that was the problem.

  • Application deployment evaluation powershell script

    Hi,
    Is there a way that I can run a powershell script or vbs script that will allow me to run the Client actions on the local client. kind of like a shortcut that will go into the configuration manager client control panel icon and run the client action required.
    Specifically for the Application Deployment Evaluation
    Any help would be appreciated
    Regards
    Mike

    Hi,
    Check out this old thread on the topic,
    http://social.technet.microsoft.com/Forums/en-US/9ec7318f-4ab7-4db3-bfa5-958ab1c39f4f/application-deployment-evaluation-cycle-not-willing-to-start-by-script?forum=configmanagersdk
    An example is included in there as well.
    You can also use the Right-click tools extensions in the console which include this action as well.
    http://myitforum.com/myitforumwp/2012/09/21/sccm-rctools/
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • Trying to deploy a batch or powershell script unsuccessful

    I've deployed a .cmd file out that contains a WMI script to uninstall all instances of an application called "VirtViewer". The script looks like this:
    taskkill /F /IM remote-viewer.exe /T
    wmic product where "name like 'VirtViewer%%'" call uninstall /nointeractive
    exit /B %EXIT_CODE%
    Previously, I had used MSI product codes for the uninstall, and got the same result. My original problem, is that there are currently 9 different versions of this app out there, so i am ripping them all out and replacing with 1 version. Installing over an
    old version does not overwrite the older one, it instead installs a new instance.
    Reading through the execmgr.log on the client, everything looks as it should.
    The end result, is that nothing happens. I had originally set the program to run as hidden, but then changed it to normal but still do not see it run. The application is right where i left it, untouched. If i run the script locally it works fine, but not
    when deployed. Am i missing something??
    <![LOG[Service startup.]LOG]!><time="16:09:31.647+300" date="01-12-2015" component="execmgr" context="" type="1" thread="248" file="execmgr.cpp:135">
    <![LOG[A user has logged on.]LOG]!><time="16:09:43.507+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4256" file="execreqmgr.cpp:4911">
    <![LOG[Requesting content from CAS for package VNT00018 version 21]LOG]!><time="16:11:13.649+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="contentaccesshelper.cpp:246">
    <![LOG[Policy arrived for parent package VNT00018 program Uninstall Script]LOG]!><time="16:11:13.649+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="execreqmgr.cpp:6893">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 6l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="event.cpp:405">
    <![LOG[Successfully created a content request handle {B2BA42EE-5988-47F4-BF44-ADAAC975994B} for the package VNT00018 version 21]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="contentaccesshelper.cpp:331">
    <![LOG[Program Uninstall Script change to state STATE_ADVANCED_DOWNLOAD content available]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="2" thread="124" file="executionrequest.cpp:3663">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from NotExist to AdvancedDownload]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="executionrequest.cpp:501">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="event.cpp:405">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramOfferReceivedEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    DateTime = "20150112211113.665000+000";
    MachineName = "VM-WIN7-MIKE";
    ProcessID = 1788;
    SiteCode = "VNT";
    ThreadID = 2528;
    ]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="event.cpp:715">
    <![LOG[Mandatory execution requested for program Uninstall Script and advertisement VNT20014]LOG]!><time="16:11:13.680+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:3527">
    <![LOG[Creating mandatory request for advert VNT20014, program Uninstall Script, package VNT00018]LOG]!><time="16:11:13.680+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:3653">
    <![LOG[An existing MTC token was not supplied, using ExecutionRequest's Id as MTC token and this execution request is the owner of resultant MTC task.]LOG]!><time="16:11:13.696+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:8942">
    <![LOG[Request a MTC task for execution request of package VNT00018, program Uninstall Script with request id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:13.696+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:8966">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from WaitingDependency to Ready]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:501">
    <![LOG[MTC task with id {D52026A7-5735-402B-868C-EF9791656512}, changed state from 0 to 4]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6288">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">
    <![LOG[MTC signaled SWD execution request with program id: Uninstall Script, package id: VNT00018 for execution.]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6406">
    <![LOG[Sending ack to MTC for task with id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:9005">
    <![LOG[Executing program VirtViewerUninstall.cmd in Admin context]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:3239">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from Ready to NotifyExecution]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:501">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.759+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[Checking content location C:\Windows\ccmcache\1c for use]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:1663">
    <![LOG[Successfully selected content location C:\Windows\ccmcache\1c]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:1719">
    <![LOG[Executing program as a script]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionengine.cpp:82">
    <![LOG[Successfully prepared command line "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd"]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:650">
    <![LOG[Command line = "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd", Working Directory = C:\Windows\ccmcache\1c\]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:352">
    <![LOG[Running "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd" with 32bitLauncher]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:370">
    <![LOG[Created Process for the passed command line]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:513">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramStartedEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    CommandLine = "\"C:\\Windows\\ccmcache\\1c\\VirtViewerUninstall.cmd\"";
    DateTime = "20150112211113.852000+000";
    MachineName = "VM-WIN7-MIKE";
    PackageName = "VNT00018";
    ProcessID = 1788;
    ProgramName = "Uninstall Script";
    SiteCode = "VNT";
    ThreadID = 2164;
    UserContext = "NT AUTHORITY\\SYSTEM";
    WorkingDirectory = "C:\\Windows\\ccmcache\\1c\\";
    ]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:715">
    <![LOG[Raised Program Started Event for Ad:VNT20014, Package:VNT00018, Program: Uninstall Script]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:459">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.868+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[MTC task with id {D52026A7-5735-402B-868C-EF9791656512}, changed state from 4 to 5]LOG]!><time="16:11:13.884+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6288">
    <![LOG[Program exit code 0]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="scriptexecution.cpp:676">
    <![LOG[Looking for MIF file to get program status]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executionstatus.cpp:282">
    <![LOG[Script for Package:VNT00018, Program: Uninstall Script succeeded with exit code 0]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executionstatus.cpp:262">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramCompletedSuccessfullyEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    DateTime = "20150112211117.571000+000";
    MachineName = "VM-WIN7-MIKE";
    PackageName = "VNT00018";
    ProcessID = 1788;
    ProgramName = "Uninstall Script";
    SiteCode = "VNT";
    ThreadID = 4128;
    UserContext = "NT AUTHORITY\\SYSTEM";
    ]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="event.cpp:715">
    <![LOG[Raised Program Success Event for Ad:VNT20014, Package:VNT00018, Program: Uninstall Script]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executioncontext.cpp:483">
    <![LOG[Execution is complete for program Uninstall Script. The exit code is 0, the execution status is Success]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:4165">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 10l, value Result:TRUE ,SDKCallerId:, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:17.602+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">
    <![LOG[Requesting MTC to delete task with id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:9036">
    <![LOG[MTC task with id: {D52026A7-5735-402B-868C-EF9791656512} deleted successfully.]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:9065">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">

    I just tried using powershell to accomplish the same task, and got the same result. Script ran fine, but nothing resulted. 0 errors in the execmgr.log on the client.
    Program options:
    Command Line: Powershell.exe -executionpolicy Bypass -file .\VirtUninstall.ps1
    the powershell script looks like this:
    $app = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match "VirtViewer*"}
    $app.Uninstall()
    exit /B
    Again, the script runs great when launched locally, but not wehen deployed

  • SCCM 2012 application run Powershell script and return codes

    Hi,
    I created an new application (imported as MSI) in SCCM 2012R2. After import I changed the deployment type installation program to run a Powershell script: powershell.exe -ExecutionPolicy Unrestricted -File "Install FactSet 2013 5I.ps1
    My goal is to close some processes before installing the MSI. This works. But on a failure the application program also return code 0 (AppEnforce.log). Is it possible to pass the MSI return codes to SCCM.
    Maybe anyone had the same or idea's to solve this? Thanks in advance.
    Regards,
    Peter
    Powershell script code:
    $ExitCode=0
    Function
    Stop-RunningApplication{
    Param(
    [parameter(Mandatory
    =$true)]
    [string]$ProcessName#
    Specify process names separated by commas
    # Split multiple processes on a comma and join with the regex operator '|' to perform "or" match against
    multiple applications
    $processName=$processName-split(",")
    -join("|")
    $process=Get-Process|Where{
    $_.ProcessName
    -match$processName}
    |Stop-Process-Force
    #Stop running processes
    Stop-RunningApplication
    -ProcessName"excel,outlook,fdsw32,marquee,POWERPNT,WINWORD"
    #Install FactSet 2013 5I
    $ExitCode
    =(Start-Process".\FactSet_Setup_2013_5I_x644.msi"'/qn
    FACTSET_CLOSE_PROCESSES=1 /l*v C:\Temp\InstFac20135I.log'-Wait-Passthru).ExitCode
    Environment]::Exit($ExitCode)
    Peter vd Bosch

    It's really hard to tell from the code above because of the way it's listed, but are sure that even executes? I see at least one stray curly brace and a stray square bracket.
    For the Start-Process cmdlet, have you tried without the -passthru parameter?
    Also, using the actual parameters will make the code much more readable instead of relying on position.
    Jason | http://blog.configmgrftw.com | @jasonsandys

  • Powershell scripting multiple WSP deployment

    I'm moving an application with around 40 custom WSPs to a new environment, and need to find a way to script their deployment. Around half of them are Globally deployed.
    I can deploy them one at a time using
    add-spsolution –literalpath c:\...\SolutionName.wsp
    Check _admin/solutions.aspx to ensure it's in Solution Management
    Select wsp and Deploy Solution
    Go to application
    Site Actions > Site Settings > Site Collection Administration > Site Collection Features
    Activate new feature
    Can anyone point out documentation on how to do this in an automated fashion? 
    Thanks,
    Scott

    Hi Scott,
    Powershell script for deploying multiple solution
    http://deploymentpowershell.codeplex.com/
    http://gallery.technet.microsoft.com/projectserver/Deploy-multiple-wsp-file-1114692f
    and this thread as simplified version
    http://social.technet.microsoft.com/Forums/en-US/72771456-5e6e-4910-b586-a4450ac61c3d/how-to-deploy-multiple-wsp-solutions-in-the-farm-or-same-server?forum=sharepointadminprevious
    You can check this site to learn PowerShell
    http://technet.microsoft.com/en-us/sharepoint/jj672838.aspx
    http://sergeluca.wordpress.com/2011/09/07/my-sharepoint-2010-powershell-tutorial-for-sharepoint-200-developers/
    http://www.youtube.com/watch?v=UuLho-HecXA
    there are good books on PowerShell
    PowerShell for SharePoint 2013 how to
    Beginning PowerShell for SharePoint 2013
    see this blog for more information
    http://www.matthewjbailey.com/sharepoint-powershell-programming-learning/
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • SharePoint PowerShell script to open Excel.Application on Windows server 2008 R2

    Hi
    I am building a PowerShell script to open an Excel file store on SharePoint document library.  Sound simple enough but I just couldn't get over an error and hopefully someone can help give an answer here.
    I have found many sample codes to use.  All of the sample codes show that a new object must be created for Excel application
    like ($Excel = New-Object -comobject Excel.Application) before that excel file can be read.
    When I run this comand on a SharePoint server (Windows 2008 R2) either inside the script or by itself I keep getting the following error:
     New-Object : Cannot load COM type Excel.Application.
    + $excel = New-Object <<<<  -Com Excel.Application
        + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    For the test,  I ran this comand on a Windows 7 with MS Office applications installed,  then it ran fine.
    Is that because I don't have Office application (Excel) installed on the server to run this or some services need to be turned on?
    From the sample codes, look like I should be able to run it on the Server with SharePoint installed.
    Thanks for any advice or solution to resolve my issue.
    Swanl

    So I'm assuming this won't return anything either?
    Get-WMIObject Win32_ClassicCOMClassSetting | ? {$_.VersionIndependentProgId -like 'excel.application'}
    You need Office/Excel installed on the server because you're accessing those .DLLs for the automation functionality, but depending on what you're trying to do you may be able to use one of the office viewers:
    http://www.microsoft.com/en-us/download/details.aspx?id=10 although I'm not sure how much of the com (if any) is exposed in a viewer install.  if Office is not possible due to
    budget reasons, I believe there are several 3rd party providers who can produce a com object that will handle Excel formats.

  • Powershell script deployment options in CM2012

    Hello all,
    I really don't know anything about PowerShell, but I found this interesting script to help with client issues. It references an input file that I can modify. My silly question is, what is the best way to use this script in CM2012? Try to create a package
    and use this, create a task sequence or query? I am unsure how to use this. Any help/guidance/links would be greatly appreciated! Thanks! 
    #ERROR REPORTING ALL
    Set-StrictMode -Version latest
    #STATIC VARIABLES
    $SCRIPT_PARENT = Split-Path -Parent $MyInvocation.MyCommand.Definition
    #FUNCTION RepairSCCM
    Function Repair_SCCM
    Write-Host "[INFO] Get the list of computers from the input file and store it in an array."
    $arrComputer = Get-Content ($SCRIPT_PARENT + "\input.txt")
    Foreach ($strComputer In $arrComputer)
    #Put an asterisk (*) in front of the lines that need to be skipped in the input file.
    If ($strComputer.substring(0,1) -ne "*")
    Write-Host "[INFO] Starting trigger script for $strComputer."
    Try
    $getProcess = Get-Process -Name ccmrepair* -ComputerName $strComputer
    If ($getProcess)
    Write-Host "[WARNING] SCCM Repair is already running. Script will end."
    Exit 1
    Else
    Write-Host "[INFO] Connect to the WMI Namespace on $strComputer."
    $SMSCli = [wmiclass] "\\$strComputer\root\ccm:sms_client"
    Write-Host "[INFO] Trigger the SCCM Repair on $strComputer."
    # The actual repair is put in a variable, to trap unwanted output.
    $repair = $SMSCli.RepairClient()
    Write-Host "[INFO] Successfully connected to the WMI Namespace and triggered the SCCM Repair on $strComputer."
    ########## START - PROCESS / PROGRESS CHECK AND RUN
    # Comment the lines below if it is unwanted to wait for each repair to finish and trigger multiple repairs quickly.
    Write-Host "[INFO] Wait (a maximum of 7 minutes) for the repair to actually finish."
    For ($i = 0; $i -le 470; $i++)
    $checkProcess = Get-Process -Name ccmrepair* -ComputerName $strComputer
    Start-Sleep 1
    Write-Progress -Activity "Repairing client $strComputer ..." -Status "Repair running for $i seconds ..."
    If ($checkProcess -eq $Null)
    Write-Host "[INFO] SCCM Client repair ran for $i seconds."
    Write-Host "[INFO] SCCM Client repair process ran successfully on $strComputer."
    Write-Host "[INFO] Check \\$strComputer\c$\Windows\SysWOW64\CCM\Logs\repair-msi%.log to make sure it was successful."
    ElseIf ($i -eq 470)
    Write-Host "[ERROR] Repair ran for more than 7 minutes. Script will end and process will be stopped."
    Invoke-Command -Computer $strComputer { Get-Process -Name ccmrepair* | Stop-Process -Force }
    Exit 1
    ########## END - PROCESS / PROGRESS CHECK AND RUN
    Catch
    Write-Host "[WARNING] Either the WMI Namespace connect or the SCCM Repair trigger returned an error."
    Write-Host "[WARNING] This is most likely caused, because there is already a repair trigger running."
    Write-Host "[WARNING] Wait a couple of minutes and try again."
    # If the script keeps throwing errors, the WMI Namespace on $strComputer might be corrupt.
    # RUN SCRIPT
    Repair_SCCM
    #Finished
    DM

    Hi,
    ConfigMgr questions should be asked in a ConfigMgr forum:
    https://social.technet.microsoft.com/Forums/en-US/home?forum=configmanagersdk
    At a quick glance though, you shouldn't be deploying this anywhere. Just run it.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Executing SCVMM PowerShell scripts via C# conditionally works depending on application type

    I suspect that this is the wrong forum but I could not find one that was appropriate.
    The environment is SCVMM 2012 R2. I have a series of PowerShell scripts that are executed via C# code from a variety of applications -- MVC, WCF, console, unit tests. It seems that successful connection to the VMM server is dependent on the type of application
    being used. For example, console apps and WCF apps can connect successfully but the
    same code running in a unit test or standard MVC app throw the following exception:
    {You cannot access VMM management server SC-01. (Error ID: 1604)
    Contact the Virtual Machine Manager administrator to verify that your account is a member of a valid user role and then try the operation again.}
        CategoryInfo: {ReadError: (:) [Get-SCVirtualMachine], CarmineException}
        ErrorDetails: {You cannot access VMM management server SC-01. (Error ID: 1604)
    Contact the Virtual Machine Manager administrator to verify that your account is a member of a valid user role and then try the operation again.}
        Exception: {"You cannot access VMM management server SC-01.\r\nContact the Virtual Machine Manager administrator to verify that your account is a member of a valid user role and then try the operation again."}
        FullyQualifiedErrorId: "1604,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetVMCmdlet"
        InvocationInfo: Command = {Get-SCVirtualMachine}
        PipelineIterationInfo: Count = 0
        ScriptStackTrace: "at <ScriptBlock>, <No file>: line 1"
        TargetObject: null
    I suspect that somehow, each app is running under different credentials but I cannot see how that is possible. Each app exhibits the stated behavior whether running within Visual Studio (w/ IIS Express) [running under my own account] or published to the
    server running under a specific specified account that definitely has permissions to the VMM environment.
    This behavior is easily reproducible with the following code
    -- PS Script as embedded resource
    Get-SCVirtualMachine -VMMServer "SC-01"
    -- C# code to load and execute script
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Management.Automation;
    namespace LabManagement {
    public class HyperVVirtualMachineManager {
    public IEnumerable<Models.VirtualMachine> GetVirtualMachines() {
    var vms = new List<Models.VirtualMachine>();
    try {
    using (var rs = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()) {
    rs.Open();
    using (var ps = PowerShell.Create()) {
    ps.Runspace = rs;
    var assembly = System.Reflection.Assembly.GetExecutingAssembly();
    var scriptName = "LabManagement.Scripts.GetAllVirtualMachines.ps1";
    using (var s = assembly.GetManifestResourceStream(scriptName)) {
    using (var reader = new System.IO.StreamReader(s)) {
    var script = reader.ReadToEnd();
    ps.AddScript(script);
    var output = ps.Invoke();
    if (ps.Streams.Error.Count > 0) {
    foreach (var item in ps.Streams.Error) {
    // do something
    if (output.Count > 0) {
    foreach (var o in output) {
    // do something
    rs.Close();
    catch (RuntimeException ex) {
    // do something
    return vms;
    -- Console app (Success)
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace VirtualLabManagement.ConsoleTests {
    class Program {
    static void Main(string[] args) {
    // Arrange
    var svc = new LabManagement.HyperVVirtualMachineManager();
    // Act
    var hosts = svc.GetVirtualMachines();
    // Assert
    -- Unit Test (Fails)
    [TestMethod]
    public void TestMethod1() {
    // Arrange
    var svc = new LabManagement.HyperVVirtualMachineManager();
    // Act
    var hosts = svc.GetVirtualMachines();
    // Assert
    Assert.IsNull(hosts);
    As you can see, the code is exactly the same between the different executions but the ability to connect differs.

    Hi Sir,
    I would like to check the following items:
    1. "a variety of applications -- MVC, WCF, console, unit tests." they are all installed on same computer?
    2. VMM server still installed on same computer as these app resides in ?
    (if it is possible please detail the topology of the environment )
    If they are running at same account on same computer , I would suggest you to post this issue into Code UI forum for further assistance :
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vstest
    Best Regards,
    Elton JI
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] .

  • Which is better approach to manage sharepoint online - PowerShell Script with CSOM or Console Application with CSOM?

    Which is better approach to manage sharepoint online - PowerShell Script with CSOM or Console Application with CSOM?
    change in sharepoint scripts not require compilation but anything else?

    Yes, PowerShell is great, since you can quick change your code without compilation.
    SP admin can write ps scripts without specific tools like Visual Studio.
    With powershell you can use cmdlets,
    which could remove a lot of code, for example restarting a service.
    [custom.development]

Maybe you are looking for

  • Not able to post outbound delivery  due to error VL150

    Hi Guru, I am trying to post a return to the vendor by a returns PO. i am using VL10B to create a outbound delivery. But unfortunately the outbound delivery is created but delivery quantity is not copied from the PO.  After creating a outbound delive

  • Dynamic Variant (Variables)

    Hi all, I'm trying to create a variant to the program SAPF080. This program runs as a job once a month. In here I need to create a variant to automatically determine the entry date. This entry date should be the last financial period (not equal to th

  • What computer do i put the CD in?

    I just bought a Linksys Wireless G w/ Speedbooster(WRT54GS).. I have a laptop with built in WiFi..which is why i bought the router... Also i have a desktop with a Cable/DSL modem in my living room.. Do i install the CD on my laptop or my desktop??

  • CS2 INX to CS5.5 conversion problem

    When exporting my CS2 layouts as INX files and open them in CS5.5 this happens: The page on the left is the CS2 doc (how it should look), the page on the right is the INX opened in CS5.5. (Note how the background tint has also changed) The reason for

  • How to not display the column header in the table view?

    I do not want to display the column header in the table view, how can I achieve it?