How-To

App-V 5.0 Demo – Uninstall a Native Application

Posted on Updated on

This is the walkthrough for demo #1 in my Microsoft Master webcast on App-V 5.0 scripting.  For the full webcast information, visit https://t3chn1ck.wordpress.com/2014/02/03/playback-of-microsoft-master-app-v-5-0/.

This demo is on uninstalling native (local) applications when an App-V package is added to a system.  For this example, I used 7-zip.

1)  First, sequence your application (7-zip).  Nothing special to do, just make sure it’s been done ;-)

2)  Create a .bat file to perform the uninstall of the software.  In this case, I just looked up GUID of the package to have msiexec perform the uninstall and added an extra step to then echo “Removed 7zip” into a text file for evidence that the script executed.  So my batch file looks like below.

Note: that you don’t have necessarily have to do this uninstall so simply as I have .. or even use a .bat script.  It could be VBScript.  Or PowerShell.  And/or include any custom checks to make sure it gets removed.  And the options go on.


MsiExec.exe /x {23170F69-40C1-2702-0920-000001000000} /qb

echo Removed 7zip >> C:\uninst_7zip.txt

3)  Save your .bat file onto a server share.  This share needs to have read, list, execute rights for all users and all computers of the domain.  In my examples, I essentially just had the share as \\server\AppV_Scripts\ which I can use for other scripts and whatnot.

4)  Edit the DeploymentConfig.xml file of the AppV package.  What we want to do is

  1. Locate the <MachineScripts> section – uncomment the blocked text so it can used
  2. Locate the <AddPackage> element and delete the rest of the elements
  3. Set the <Path> to execute cmd.exe on the system
  4. Set the <Arguments> to run the .bat file on the server; if you’re unaware /c means to cmd.exe to “run this command” which would then be your \\server\share\script.bat

<!-- Machine Scripts Example - customize and uncomment to use machine scripts -->
<MachineScripts>
<AddPackage>
<Path>cmd.exe</Path>
<Arguments>/c \\alderaan2\appv_scripts\uninst_7zip.bat</Arguments>
<Wait RollbackOnError="true" Timeout="30"/>
</AddPackage>
</MachineScripts>

5)  Now we’ll add the package into ConfigMgr as an Application.  Note that ConfigMgr will choose the most recently modified Config.xml file to use for the Deployment Type.

  1. Add a new Application7zip-demo-01
  2. Select to add an App-V 5.0 package and select the .appv file7zip-demo-02
  3. Complete the wizard
  4. Using standard ConfigMgr procedures, deploy the application to the desired user collection (or computer)
  5. Run the application from the targeted user’s Application Catalog7zip-demo-03
  6. Watch the local system as the natively installed application is removed and replaced by the AppV package is there!
  7. Then check that the C:\ for presence of the uninst_7zip.txt file thus giving further proof that script executed!
Advertisements

App-V 5.0: Sequencing Visual Studio 2012

Posted on Updated on

The sequencing of Visual Studio 2012 does NOT seem to have been successfully accomplished by many people (at least not online that I can find!).  This recipe is a conglomeration of tips, tricks, fixes, and other recipes found on the web.  Hopefully it works for you too!

Notice: Visual Studio takes a long time to sequence.  At times, it will appear that the sequencer is ‘hung’.  In reality, this is normal so DO NOT terminate the window or otherwise start over.  Just allow for time (even up to 15 minutes) for the processing to complete.  An additional reference for virtualization can be found at http://social.technet.microsoft.com/Forums/en-US/7e93e525-31ed-43fc-8415-88a12766d2c2/how-to-sequence-visual-studio-2012-in-microsoft-application-virtualization-46-sp2

Prerequisites

  1. Pre-download the most recent Visual Studio 2012 Update
    1. Save into the source files
    2. Extract files to a folder in the AppV source files
    3. Update the CustomSetup.bat to call this
  2. Ensure VM has at least 45 GB disk
  3. Download the MVLS edition of VS then copy the installer and all subdirectories to a local folder
  4. Create an AdminDeployment.xml with SharePoint tools and SQL to not install (such as code snippets below)
         <SelectableItemCustomization Id="SharepointTools" Hidden="no" Selected="no"/>
         <SelectableItemCustomization Id="SQL" Hidden="no" Selected="no" />
  5. Install Microsoft .NET Framework 4.5 on the Sequencer machine. Using Microsoft Update, install all updates for .NET Framework 4.5
  6. Install IIS Express 8 (from iisexpress_8_0_RTM_x64_en-US.exe)
  7. Open an Administrator Command Prompt and run:
    1. C:\Windows\microsoft.net\framework\v4.0.30319\ngen.exe executeQueuedItems
    2. C:\Windows\microsoft.net\framework64\v4.0.30319\ngen.exe executeQueuedItems
  8. On Windows 7, disable the services:
    1. “Microsoft .NET Framework NGEN v4.0.30319_32”
    2. “Microsoft .NET Framework NGEN v4.0.30319_64”
  9. Open Regedit.exe, change the Permissions of the two following registry keys, granting Full Access to the Administrators group
    1. HKLM\System\CurrentControlSet\Services\DcomLaunch
    2. HKLM\System\CurrentControlSet\Services\RpcSS
  10. Restart Windows
  11. Now is a good time to make a snapshot/checkpoint :-)

Sequencing

vs12-01

CustomSetup.bat will do the following:

  1. Unattended install of the MVLS copy of Visual Studio 2012 Pro
  2. Disable prompt to download/install local help files on software first run
  3. Install help files

"%~dp0vs_professional.exe" /passive /adminfile "%~dp0AdminDeployment.xml"

:: Disable prompt to download/install local help files on first run reg add HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Help /v
DisableFirstRunHelpSelection /t reg_dword /d 1 /f

:: Install help files
:: Note this is disabled due to space constraints but could potentially be enabled
:: "C:\Program Files (x86)\Microsoft Help Viewer\v2.0>hlpctntmgr.exe" /operation install /catalogname VisualStudio11 /locale en-s /sourceuri \\ServerShareWhatever\VS2012Documentation\helpcontentsetup.msha

:: Fix for IEXPlorer
reg add HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE /v /T REG_SZ /d """c:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE"""
reg add HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE /v /T REG_SZ /d """c:\Program Files (x86)\Internet Explorer"""

vs12-02

Visual Studio 2012 Professional

C:\Program Files (x86)\Microsoft Visual Studio 11.0

vs12-03

After the install completes, do not close the sequencer, but just restart Windows and login.  The sequencer will resume.

Run the latest update that was downloaded as part of the prerequisite steps

vs12-04

After the install completes, do not close the sequencer, but just restart Windows and login.  The sequencer will resume.

Locate the Developer Command Prompt and do a Run as Admin

vs12-05

Run regedit.exe

vs12-06

Delete the value of SetupCommandLine in HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0

vs12-07

Done installing

vs12-08

Do not run anything

vs12-09

vs12-10

Stop Now

vs12-11

vs12-12

Locate and delete the following in the VFS

  1. [{AppVPackageRoot}]\Common7\IDE\Extensions\random.folder\package\services\digital-signature\_rels
  2. [{AppVPackageRoot}]\Common7\IDE\Extensions\random.folder\_rels

vs12-13

vs12-15

(Optional step, but advisable for Standalone App-V 5.0 Infrastructure)

Add the .NET Framework 4.5, IIS Express 8.0 installers, and custom install.bat script (which just installs both items) into the scripts folder

vs12-14

Now save your package because it’s ready for deployment!!

If you did the optional step above, then edit the saved Deployment.xml file to run a user script for installing IIS Express 8.0 and .NET 4.5 locally

<UserScripts>
   <PublishPackage>
      <Path>cmd.exe</Path>
      <Arguments>/c [{AppVPackageRoot}]\..\Scripts\install.bat</Arguments>
      <Wait RollbackOnError="true" Timeout="600"/>
   </PublishPackage>
</UserScripts>

Additional Notes

When starting the software for the first time, select to use General Development Settings and to not install local help.

vs12-16

Create ConfigMgr Package for Office 365 Pro Plus

Posted on Updated on

Quick guide to create an O365 Pro Plus (e.g. Click-To-Run) deployment with ConfigMgr

  1. Obtain the source files
    1. Download the Office Deployment Tool for Click-To-Run
    2. Run the wizard (or use a tool such as 7-zip) to extract Setup.exe
    3. setup.exe /download <path of Configuration.xml file>
  2. Create a configuration file based upon config your desired configurations (or use the example below)
    http://community.office365.com/en-us/blogs/office_365_community_blog/archive/2013/03/06/office-365-proplus-administrator-series-client-deployment-options.aspx
  3. Create a ConfigMgr package with the setup.exe, configuration.xml file(s), and the download Office folder
  4. Create a program for the package to run command line setup.exe /configure <path of Configuration.xml file>
    (setup will locate the source files within the Office folder)

Example configuration.xml file for deployment

<Configuration>
  <Add OfficeClientEdition="32" >
    <Product ID="O365ProPlusRetail">
      <Language ID="en-us" />
    </Product>
  </Add>
  <Updates Enabled="TRUE" />
  <Display Level="None" AcceptEULA="TRUE" />
  <Logging Name="O365ProPlusRetail.log" Path="%temp%" />
  <Property Name="AUTOACTIVATE" Value="1" />
</Configuration>

Below are some additional resources provided to me by a colleague which were of additional help.

  1. How to customize the xml: us/download/details.aspx?id=36778
  2. TechNet talking how to deploy it:  http://technet.microsoft.com/en-us/library/jj839718(v=office.15).aspx
  3. TechNet talking about the /download and /configure commands:  http://technet.microsoft.com/en-us/library/jj219422(v=office.15).aspx

 

Deploying Android Apps with Windows Intune

Posted on Updated on

Using Windows Intune standalone?  You can quickly deploy apps using the following process!  This example utilizes an Android emulator being managed through Intune.  For more information on how to set that up for testing, see https://t3chn1ck.wordpress.com/2013/05/01/setting-up-windows-intune-to-manage-android/.

Upload Android APK App

To begin, be sure to obtain a safe APK that you can deploy (e.g. don’t download an infected app!)

Click button to Add Software

andappdep01

Select the Android app installer type

andappdep02

Enter the desired app properties

andappdep03

Specify the Android OS version that the app can be installed upon

andappdep04

Finish the wizard

andappdep05

Deploy App to Device Group

Click button to Manage Deployment

andappdep06

Select the target group (this example just uses a static membership with my Intune user account)

andappdep07

Ensure the approval is set to be Available

andappdep08

Install App on Android Device

On your Android device (an emulator in this example), go to https://m.manage.microsoft.com and sign in

andappdep09

Select the app category

andappdep10

Select the app

andappdep11

Click “Get app”

andappdep13

When the app has been download, click the “drop arrow” that appears in the upper-left corner

andappdep12b

Select the app

andappdep14

Select to Install (lower-right)

andappdep15

And voila…you’re app is installed!!

andappdep16

How To Execute Scripts in a Task Sequence Without a Local Disk

Posted on Updated on

A common practice for OSD task sequences is set the advertisement to “run from server”.  Recently there was a situation in which the advertisement needed to be set as “download content locally”.  But there were scripts which needed to be executed BEFORE a disk partition existed, so the task sequence would fail with error code 0x800700a1 because there wasn’t a local disk in which to save the files.

There are a few ways to workaround this situation.

1.  If possible, have the advertisement/deployment configured to run from server

2.  Use DISM.exe to add the scripts into the boot image(s) (or use GImageX), then have a Run Command Line task to execute the scripts.
Note: the challenge with this method is it’s a bit tedious to maintain those scripts.

3.  Use the “Connect To Network” task to map to a network drive, then have a Run Command Line task to execute the scripts.
Note: the challenge with this method is the possibility of scripts running across the WAN, which could be less than ideal if the scripts or installers are large or if the network files are not available.

ConnectNetworkFolder

RunCommandLineMyScript

Custom query of ACT data for apps with issues

Posted on Updated on

The application compatibility toolkit (ACT) is a great tool for analyzing compatibility of apps when doing a migration of Windows.  However, the available “reports” are limited in what they display out-of-box.  Fortunately since the tool is a SQL database, we can write our own queries to get what we need.  The below procedure/query will identify business specific apps and the detected compatibility issues.

  1. Create and customize an ACT query (within the compatibility manager) which identifies your specific business software
  2. Select all of the apps listed
  3. Create a new custom category “Priority Business Apps”
    • For the primarily used business apps, create/select sub category “PrimaryApps”
    • For the secondarily used business apps, create/select sub category “SecondaryApps”
      ACTCategories
  4. Run the following query against the ACT database
    Select distinct CAQ.subCategory, AR.AppName, LI.issueID, AIQ.severity, LI.title, LI.Details
    from Applications AR
    join AppReport_Issues_Query AIQ on AIQ.appID=AR.identity_hash
    join Categorized_Applications_Query CAQ on CAQ.objectID=AR.identity_hash
    join Localized_Issue LI on LI.issueID=AIQ.issueID
    where CAQ.category='Priority Business Apps'
    
  5. Copy the results into Excel

AppIssuesQuery

Standalone Imaging Solution

Posted on

I’ve been in a situation a couple of times where a client was going to use a third-party vendor to image hardware offsite, but didn’t have Microsoft deployment tools (WAIK, WDS, MDT, SCCM, etc.) for deploying the standard WIM image that was created.  To work with this scenario, I developed an unattended answer file with WSIM that can be used to sysprep a computer for an image where the disk can be cloned.  This sysprep file essentially does the following items below.  Many of the items may seem “unnecessary”, but they are necessary in order to automate the majority of the deployment.

Sysprep.xml Features

  • enables the local admin account
  • removes the “copy profile” functionality
  • removes the “Get Windows Live” shortcuts
  • sets the time zone to MST
  • enables RDP
  • disables firewall notifications
  • disables the domain firewall
  • disables Windows Defender
  • disables IE accelerators
  • disables the IE first run wizard
  • enables IE compatibility mode
  • disables IE suggested sites
  • sets Windows to skip auto activation
  • disables system restore
  • sets the local language to English
  • sets the registered owner/org
  • sets Windows to automatically login as Administrator one time
  • sets the screen resolution to 1024×768
  • sets the first logon command to execute a script in C:\CompanyName
  • Hides the Windows EULA Hides the wireless network setup wizard
  • sets the default network location to “Work”
  • sets the recommended level of protection for Windows Update
  • creates taskbar links to Outlook and Word

Download sysprep.xml here!!

Next, the overall process looks like such:

  1. Automate driver installation using HP SoftPaqs and script to copy the files into C:\CompanyName\ModelName\
    1. Optionally, automate and script BIOS updates
  2. Create script named “ImageConfigTasks.vbs” (code below) to do the following items (this will run post sysprep).  Script should be copied into C:\CompanyName.  You can use the attached script as a starting point.
    1. Prompt for PC name
    2. Detect PC model and install drivers (do this next to ensure the NIC driver gets installed for the domain join)
    3. Join to domain and OU
    4. Install SCCM client
    5. Install SCEP client
    6. Restart Window
  3. Create sysprep.xml file with x64 bits which essentially allows the PC to auto logon into Windows with the admin account and launches ImageConfigTasks.  You can use the attached sample as guidance, but do not actually use this file as it was compiled for the x86 components and you need it for x64.
  4. Create a “build” task sequence which installs Windows, software, security updates, copy of the drivers into the CompanyName folder, copy of the ImageConfigTasks script, copy the sysprep.xml file
  5. Run the task sequence on a VM
  6. After completion, login to Windows and run %SYS32%\sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:C:\CompanyName\sysprep.xml
    1. This will sysprep the PC’s disk for cloning.  Do not power on the PC once its shutdown!
    2. Optionally, you can creatively automate this process so that you do not need to actually login to the PC
  7. Once the PC with the cloned disk has been delivered onsite, power on the PC.  Windows will go through mini-setup to install generic devices.  Then Windows will auto logon to run the script and complete the setup process.

Download the ImageConfigTasks script here!!

Run on physical hardware

To build-out this custom solution for the vendor, do the following.

  1. Complete and “certify” the newly captured image (note: this is still in progress as of 12:15 PM today, but is looking good to complete successfully).
  2. Use the deployment task to install this image AND the hardware drivers AND any other software/configurations that did not make it into the image.  You may also want to change the task sequence to NOT join to the domain for this model so that it does not receive [junky] group policies.
  3. Once that task sequence is done, login to Windows as the local admin account.
  4. Ensure the two script files live in C:\CompanyName
  5. Run %SYS32%\sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:C:\CompanyName\sysprep.xml
  6. DO NOT TURN THE COMPUTER ON.  Remove the hard drive and give to vendor.  Once a cloned PC is onsite and connected to the network, only then should the PC be turned on.  A prompt for the computer name will appear and then the custom script will execute.

While you’re in the process of testing/development, you can of course turn it on to validate the scripts execute, drivers are installed, etc.