Bulk App Migration script: PSADT Packages to Intune Win32App

Deploying applications via Microsoft Intune can be streamlined using the IntuneWinAppUtil tool. To automate the conversion of existing PSADT (PowerShell App Deployment Toolkit) packages into IntuneWinApp packages, we can leverage this PowerShell script. This blog post will walk you through the process of setting up and running a PowerShell script that handles the automation, including clearing temporary files and freeing memory to avoid system resource issues.

Saving Repackaging Costs

By automating the Intune packaging process, organizations can significantly reduce the time and effort required for application deployment.

In this example, I was able to bulk convert approximately 500 GB of applications. To manually repackage each application, it would have taken months. This automation not only speeds up the deployment process but also helps in saving substantial repackaging costs associated with manual application packaging. Automation ensures consistency and reduces human error, leading to a more efficient and cost-effective deployment strategy.

Prerequisites

Before we dive into the script, ensure you have the following:

  • PSADT packages organized in a specific directory structure.
  • IntuneWinAppUtil executable.
  • PowerShell environment set up with necessary permissions.
  • Significant disk space to accommodate source and output files

Directory Structure assumptions

The script assumes the PSADT package folder structure as follows. For custom folder structures, please feel free to edit the code:

E:\PSADTPackageSource
    ├── ApplicationName1
    │   ├── VersionNumber1
    │   │   └── PSADT
    │   └── VersionNumber2
    │       └── PSADT
    ├── ApplicationName2
    │   ├── VersionNumber1
    │   │   └── PSADT
    │   └── VersionNumber2
    │       └── PSADT

E:\OUTPUT -- Folder to store Win32Apps

The Migration Script

The following PowerShell script automates the creation of IntuneWinApp packages from the PSADT packages:

Download the script from Github

# Define the base directories
$automationBaseDir = "E:\PSADTPackageSource"
$outputBaseDir = "E:\OUTPUT"

# Define the path to IntuneWinAppUtil executable
$intuneWinAppUtilPath = "E:\IntuneWinAppUtil\IntuneWinAppUtil.exe"

# Define colors for Write-Host output
$colors = @("Cyan", "Green", "Yellow", "Magenta", "Blue", "Red", "White")

# Function to clear temporary files
function Clear-TempFiles {
    Write-Host "Clearing temporary files..." -ForegroundColor "Yellow"
    Remove-Item -Path "$env:TEMP\*" -Force -Recurse -ErrorAction SilentlyContinue
    Remove-Item -Path "$env:LOCALAPPDATA\Temp\*" -Force -Recurse -ErrorAction SilentlyContinue
}

# Function to free memory
function Free-Memory {
    Write-Host "Freeing memory..." -ForegroundColor "Yellow"
    [System.GC]::Collect()
    [System.GC]::WaitForPendingFinalizers()
    [System.GC]::Collect()
}

# Traverse the automation base directory
Get-ChildItem -Path $automationBaseDir -Directory | ForEach-Object {
    $applicationNameDir = $_.FullName
    $applicationName = $_.Name
    $colorIndex = 0

    Get-ChildItem -Path $applicationNameDir -Directory | ForEach-Object {
        $versionNumberDir = $_.FullName
        $versionNumber = $_.Name
        $psadtFolder = "$versionNumberDir\PSADT"

        if (Test-Path $psadtFolder) {
            # Define the output directory for the IntuneWinApp package
            $outputDir = "$outputBaseDir\$applicationName\$versionNumber\Win32App"

            # Create the output directory if it doesn't exist
            if (-not (Test-Path $outputDir)) {
                New-Item -ItemType Directory -Path $outputDir -Force
            }

            # Define the source setup file (assuming the main PSADT script is Deploy-Application.exe)
            $sourceSetupFile = "Deploy-Application.exe"

            # Construct the command to run
            $command = "`"$intuneWinAppUtilPath`" -c `"$psadtFolder`" -s `"$sourceSetupFile`" -o `"$outputDir`" -q"
            Write-Host "Running command: $command" -ForegroundColor "Gray"

            # Run the IntuneWinAppUtil command in a new PowerShell process
            $powershellCommand = "Start-Process powershell -ArgumentList '-NoProfile -NoLogo -Command `"$command`"' -Wait -NoNewWindow"
            Invoke-Expression $powershellCommand

            # Clear temporary files and free memory
            Clear-TempFiles
            Free-Memory

            # Print the folder processing information
            Write-Host "Processed: $applicationName - $versionNumber" -ForegroundColor $colors[$colorIndex % $colors.Count]

            # Increment the color index
            $colorIndex++
        }
    }
}

Write-Host "Conversion process completed." -ForegroundColor "Green"
  1. Directory Setup: The script assumes a base directory E:\PSADTPackageSource where the PSADT packages are stored and an output directory E:\OUTPUT for the resulting IntuneWinApp packages.
  2. Clearing Temporary Files: The Clear-TempFiles function clears both the system TEMP directory and the user-specific AppData\Local\Temp directory.
  3. Freeing Memory: The Free-Memory function triggers garbage collection to free up memory.
  4. Processing Each Package: The script traverses the directory structure, processes each version of each application, runs the IntuneWinAppUtil command, and clears temporary files and memory after each package creation.

Running the Script

Save the script as a .ps1 file and run it in a PowerShell console with the necessary permissions. Ensure the IntuneWinAppUtil.exe path is correctly set in the script.

Automating the packaging of Intune applications using PowerShell and PSADT can significantly streamline the deployment process. By incorporating memory and temporary file management, this script ensures efficient and error-free execution, making it a powerful tool for IT administrators.

For more detailed documentation on PSADT and IntuneWinAppUtil, refer to the PSADT Documentation and IntuneWinAppUtil Guide.

How to make permanent system tray icons in Windows 11

Windows 11 has introduced several changes to the user interface and system functionality, including the way system tray icons are managed. While these changes offer a sleek and modern appearance, they have posed a challenge for developers and system administrators who need to programmatically create permanent system tray icons without clicking the ‘up’ button. In Windows 11, the option to permanently display these icons without user intervention or choice is no longer available. In contrast to Windows 10, where this process was straightforward using XML, Windows 11 requires a more creative approach.

In this article, we’ll explore a solution that empowers developers and system administrators to regain control over system tray icons in Windows 11.

The Script Solution

The solution to this challenge lies in a script that leverages the Windows registry to customize system tray icons. In my example, my custom application (SatyamKrishnaSystemApp) is developed in Powershell that creates a system tray icon. The registry that controls all the system tray icons is :

HKEY_CURRENT_USER\Control Panel\NotifyIconSettings

The script recursively searches “ExecutablePath” registry string (REG_SZ) for the keyword “*powershell.exe” under all subKeys and adds a DWORD registry to force icon visibility.

This is achieved by adding a registry DWORD value named “IsPromoted” with a hex-value 1

I also made ‘Citrix Workspace’ icon permanent by searching for the keyword “*Citrix” inside “ExecutablePath” on all subKeys and creating a ‘IsPromoted’ registry. Feel free to modify the script as needed. I also created a custom LinkedIn icon for kicks !

To automate this process using Intune:

  1. Download the custom script from GitHub.
  2. Run the script during the Windows 11 AutoPilot stage or during the application installation process.
  3. The script will recursively identify and modify the relevant registry keys.


Unifying cloud services downtime updates with Microsoft Teams

Unifying Incident Awareness: Intune, Citrix Cloud, and Azure Health Service in Teams

In the dynamic landscape of IT management, staying ahead of potential issues is paramount. With the power of automation and integration, I will guide you through the process of creating a comprehensive incident awareness solution by combining Microsoft 365 Service Health Alerts for Intune, Citrix Cloud Health Notifications outage notifications, and Azure Health Service alerts—all channeled seamlessly into your Teams workspace. The Teams channel can become central point to get notifications for all members in various timezones to keep track of incidents, downtime, uptime & updates.

Step 1: Retrieve Teams Channel Email address:

  1. Open Microsoft Teams: Launch the Microsoft Teams application on your computer or access it through your web browser.
  2. Navigate to the Desired Channel: Locate and select the Teams channel for which you want to obtain the email address. Channels are usually listed on the left-hand side of the Teams interface. We will call them Alerts for this example
  3. Click on More Options (Three Dots): Within the selected channel, you’ll see a set of three dots (ellipsis) indicating more options. Click on these dots.
  4. Select “Get Email Address”: In the dropdown menu that appears after clicking the three dots, you should find an option labeled “Get email address.” Click on it.
  5. Copy the Email Address: A unique email address associated with the Teams channel will be displayed. It will typically resemble “channelname@teams.message.” Click on the copy button next to the email address to copy it to your clipboard.
  6. Paste the Email Address: Now you can paste this email address into the relevant settings of the tools or services you want to integrate with the Teams channel.

Step 2: Setting Up Automated Alerts

Microsoft 365 Service Health Alerts for Intune: Begin by configuring Microsoft 365 Service Health by going to https://portal.office.com/adminportal/home#/servicehealth and select ‘Customize‘. Under ‘Page View‘ Tab >> Select ‘Microsoft Intune‘. Select ‘Email‘ tab and set the email address for notifications to the unique email of your desired Teams channel.

Microsoft guidance here

Citrix Cloud Health Notifications: Access the Citrix Health Dashboard and setup the outage alerts you want to receive by clicking Subscribe in top right corner. Similar to the Intune setup, direct these notifications to the same Teams channel email.

Azure Health Service: In your Azure Portal account, establish health service notifications criteria for Azure service outages. Customize the alerts to suit your organization’s needs and specify the same Teams channel email for notifications.

Microsoft guidance here

Result: A Holistic Incident Awareness Solution

Integrating Intune Health Service, Citrix Cloud Health Notifications, and Azure Portal within Teams transforms your incident awareness from scattered alerts to a unified, proactive strategy. This approach empowers your team to swiftly respond to challenges and maintain a resilient IT environment. As technology advances, this unified incident awareness approach positions your team to navigate the evolving landscape with confidence and efficiency. Emails can be missed but Teams channel notification can be tracked live for updates.

Regularly review and update the settings of each service and the Teams channel to ensure seamless flow of information. By embracing this integration, you’re not merely managing incidents; you’re fostering a culture of collaboration, proactive response, and unified incident awareness that drives your organization forward.

Automating SCCM patching process using ADRs

Let me start with a term that has often been referred by SCCM users & admins for a long time: ‘Best Practice‘. Personally, I feel there is no Best Practice for doing one thing in a certain way to achieve the end goal. With or without SCCM/MECM, one can attack the problem and navigate issues in so many different combinations.

For the purpose of writing this article on ADR, I am documenting a method that has worked for me in multiple enterprise design solutions.

As I work for a Healthcare system, the ADR solution is a little bit different from traditional design to ensure critical systems are not impacted by automated deployment & restart scenarios. It goes without saying that the process is not a representation of my organization’s policies but a general guideline on how to do things.

Let’s talk about deployment packages in SCCM, I would create four deployment packages to control them more granularly:

  1. Windows 10 Microsoft office updates
  2. Windows 10 windows update
  3. Adobe Reader updates
  4. Dell updates or any other supported third-party updates (For unsupported updates, I highly recommend PatchMyPC)

Each deployment package consists of distribution settings with medium distribution priority and content locations selecting all distribution points. You can choose the right configurations based on your SCCM layout. Also, one thing to keep in mind is to keep Adobe Reader ADR separate from other ADRs. One of the reasons to do so is because it helps prevent scheduling & content overlap with Microsoft’s Patch Tuesday.

ADR Planning

There are two school of thoughts when it comes to ADR planning :

  1. Create New SUG every time an ADR runs
  2. Add to existing SUG

The importance of SUG comes in to play as a SUG is used for grouping the software updates into one batch. For many organizations and SCCM architects have created SUG on a monthly basis which is a good practice but leads to a lot of overhead in terms of managing individual SUGs. The result is that you will end up with 12 months of SUG times two. One for Office & the other for Windows patch. Total: 24 SUGs, not to forget Adobe Reader, Dell Updates etc also need to be taken into account. I am in no way saying this is not good but it did not work for me while managing so many other stuff in SCCM. In a typical environment, you may want to spread the ADRs as Dev-QA-PROD or Lab-QA, PROD environments. This makes the total counts of SUGs 24×3= 72! on an annual basis. Too much work in my opinion. If you are able to track them, good for you!

However, adding to existing SUG is a much simpler option if you are mindful of not going beyond 2000 software updates per SUG. If you do go beyond 2000 software updates for SUG, you will need to clean it up. In my experience. for just window patches for windows 10 environment, a once an year cleanup is a must. This is a good practice to ensure that obsolete software updates are purged and also helps keep inventory clean. The total count here for SUG is just 2X3=6 which is reasonable amount of SUG to manage. I do use scripts to clean up the obsolete updates in SCCM’s SQL server every 6 months so it helps keep things in check.

Software Update Search criteria for Windows 10 & later versions:

ADR: Automatic Dancing Routine

This is where things get interesting. Reddit is filled with examples of how easy it is to time the ADR run to match up with Microsoft Patch Tuesday. There are also accounts of how hard it is to match up with a Patch-for-Patch Tuesday that often is released by Microsoft on Fridays! As mentioned earlier, there is no right or wrong approach. In fact, I have seen my management & security teams demand change in the policy that was set in stone couple of years ago. The art of getting this right is to find a balance between what Microsoft suggests & how your end user experience gets impacted. Strictly speaking in terms of Windows 10 Managed PC environment & not servers here. The server side of story is way more complex.

I call the ADR scheduling as a dance routine due to following three factors:

  1. Microsoft’s recommendation to stay approx. 1 month behind for general patching.
  2. Enterprise User experience aka business
  3. Enterprise security compliance & directive

If one of the stakeholders demands an explanation, SCCM admins & architects alike are dancing LOL.

Assumptions

  1. Change process approvals accounted for Monday, Tuesday, or Wednesday of each week *
  2. Patch-For-Patch is the security updates re-released with modifications, mostly occurring on Fridays after Patch Tuesday. It could happen any time later but the general trend I have observed is the Fridays.

ADR Schedules & Target audience

I find the following three schedules that have worked for me in various companies where I worked as SCCM engineer:

  1. DEV-Lab :
    • Schedule: Runs everyday. When Patch Tuesday occurs, the updates automatically deployed and systems rebooted per client settings.
    • Audience: Keep a good set of VDIs, Laptops, HyperVMs, PCs in this group to monitor impact.
  2. QA:
    • Schedule: Runs every Third Wednesday at around 3 pm.
      • WHY Third Wednesday: As it helps me put a method to madness. Generally, it will come one week after the Patch Tuesday (which is second Tuesday of the month). If a patch for a patch is released on Patch Friday (if that’s a term you want to call), then I would not like to update systems over the weekend to prevent potential outages. Sometimes, we run into cycles where patch Tuesday may come after second Wednesday so it helps me overcome that problem too.
      • Example: For May 2024 calendar, I don’t need to tweak my design as Patch Tuesday occurs on 14th & third Wednesday occurs on 15th. DEV/LAB to QA movement account for In this unique situation, Third Wednesday falls just one day after patch Tuesday. Had the rule been set for second Wednesday, there would be no patching activity. Patch for Patch release can be individually monitored in this scenario without disrupting ADR ruleset.
    • Audience: These are technology savvy folks i.e. IT teams etc who are well aware of the patching schedule & what needs to be done. This group also consists of critical app users with their systems in QA to report any potential issue.
  3. PROD:
    1. Schedule: 2-3 weeks after Patch Tuesday. Manually move patches from QA SUG to PROD SUG by using “Edit Membership” option. This goes in-line with change management process. I suggest always use manual process for patch movement to PROD as it gives a lot of control & fallback in case approvals are not granted due to reasons not limited to outages, application issues, network problem or simply lack of approvals.
    2. Audience: The whole village + distant hamlets.
DEV/LAB to QA movement of patches for regular patch cycle
Unique scenario: DEV/LAB to QA movement accounts for Third Wednesday which falls just one day after patch Tuesday. Had the rule been set for the second Wednesday, there would be no patching activity. Patch-for-Patch release can be individually monitored in this scenario without disrupting the ADR ruleset. This is once or twice per year scenario.

Classic CMG failed during conversion to VSS-Recovery steps

Recently I attempted to convert CMG classic to a Virtual Scale Set using the native SCCM conversion option. The conversion failed and I had to reach out to Microsoft to help and support.

Per Microsoft, I was not the only one facing this challenge. I am sharing the actions undertaken to recover from failed conversion:

Problem:  CMG went down after trying to upgrade from classic cloud to VSS to support the 2203 upgrade.

Resolution:

1. CMG showed error state and CMG connection point was disconnected in SCCM Console.

2. An attempt was made to remove the role from the site server and we reconfigured the CMG but it still failed as well. 

3. It was observed that the Classic cloud upgraded to VSS on SCCM side but failed to provision the resources in Azure as there were only classic cloud and storage in the resource group.

4. For recovery of CMG, we reverted the SCCM to classic cloud deployment using the following query:

Update azure_service set Fqdn = ‘<CMG Service Name>’ , DeploymentModel = ‘1’

6. CMG role was reinstalled again on the server to take the changes into effect and it worked after 5 minutes. 

AutoPilot Script

I use this custom script to autopilot Intune enrolled devices. The hash file gets stored in a CSV file with GroupTag/OrderID needed.

#How to Ignore TPM requ in HyperV
REG ADD HKLM\SYSTEM\Setup\LabConfig /v BypassTPMCheck /t REG_DWORD /d 1
REG ADD HKLM\SYSTEM\Setup\LabConfig /v BypassSecureBootCheck /t REG_DWORD /d 1

#Manually Register device for autopilot
New-Item -Type Directory -Path "C:\HWID"
Set-Location -Path "C:\HWID"
$env:Path += ";C:\Program Files\WindowsPowerShell\Scripts"
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
Install-Script -Name Get-WindowsAutoPilotInfo
Get-WindowsAutoPilotInfo -OutputFile AutoPilotHWID.csv -GroupTag "LAPTOP"


#While OOBE Running, you can upload it too
PowerShell.exe -ExecutionPolicy Bypass
Install-Script -name Get-WindowsAutopilotInfo -Force
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
Get-WindowsAutoPilotInfo -Online


#Troubleshooting & Exporting logs
mdmdiagnosticstool.exe -area DeviceProvisioning -cab C:\Log.CAB
net use Z: \\ServerName\SharedLocation$
Copy C:\Log.Cab Z:
#Copy that file from Z: to your local PC


#To View Log Files:
install-script -name get-autopilotdiagnostics -force
Get-AutopilotDiagnostics -CABFile C:\temp\Log.Cab

Rename file from .odt to .ps1

Bypass 8 digit PIN lock requirement for Microsoft Exchange using Samsung Galaxy S6 Fingerprint scanner

In my previous blogs I have written about issues in finger print scanner for Samsung Galaxy S5 with Microsoft Exchange email. More and more people are asking for resolutions for finger print scanner and Microsoft Exchange 8 digit PIN requirements.

I will review two new apps to deal with the situation for new models of Samsung Galaxy S6 & Note 4 (tested) and also for other android devices that have finger print scanners.

The issues have been persistent and common across the Samsung Galaxy phone’s fingerprint scanners. This is one of the biggest challenges for new users who purchase Samsung phones and want to sync their professional emails. However, they are asked 8 digit PIN requirements for Microsoft Exchange instead of allowing finger print scanner to identify the phone user at locked screen. This is one of the biggest letdown for android users and needs to be addressed by OEMs and Android dev teams. iPhone users do not face this problem as the finger print recognition technology takes the 8 digit pin requirement and maps it to Finger print of user thereby letting them login and use MS Exchange.

The two apps are TypeMail and OWA WebMail. They work in similar fashion to bypass the 8 digit PIN requirements but have their pros and cons from security level which I will discuss:

TypeMail (formerly BlueMail)

TypeMail is a beautiful app which gets the job done quickly. You can alternatively configure a Gmail, YahooMail, Outlook, Aol, and Exchange. The best part is, it is free!
The app looks very similar to Gmail android app and you can do all basic functions including tasks. The configuration of email is very simple and does not ask for 8 digit PIN on phone’s locked screen. It lets you use your fingerprint scanner to login to phone and never prompts the 8 Digit PIN. The app also integrates well with android watches so you can also see the Exchange emails on your watch. I would say the design and layout are impressively beautiful.

TypeMailFeatures

Mark your emails as read, archived or even delete them from the app. You can also view all your folders which can be synced along with tasks. Features like mobile printing and signatures are available too. One of the features I personally like is snoozing emails for later use and view.

Calendar feature is not available and it can be addressed in the next app review.

TypeMail

From security point of view, TypeMail is designed to help you manage all your email accounts. Whenever you link your email accounts for example Gmail or Microsoft Exchange, the TypeMail takes the information and securely accesses the same but keeps it temporarily on their server. Unfortunately, this credential data is stored on TypeMail servers leading to the security concern.

If you have a very secure email confidentiality requirements at your office, I would NOT recommend using the app. If you are good to use a third party server to securely access your personal & professional emails, then read the disclaimer on TypeMail website. Some professional organizations have high degree of security restrictions and might not allow you to use the type mail. It’s like sharing your user id and password with a third party.

 

OWA WebMail (Secured & supports calendar)

This snazzy little app does wonders from security point of view & I highly recommend it. This app is not aesthetically beautiful but gets the job done most efficiently. The bonus is that you can sync your calendars too which is not possible in any other app that I have seen so far. Most of the apps available on Google Play do not work with Microsoft Exchange Calendar. However, there is a way to bypass the calendar issue, which can be found in my previous blog.

Tasks & Folders view is available too. It is free but you will see small advertisements below which is ok for me.

 

OWA Webmail

How it works?

There is an extension of Microsoft Exchange server to give access on internet through web interface which is called Outlook WebApp. Many organizations use this feature for users to connect without Microsoft Outlook software when they are remote or when they don’t have office laptop devices.

OWA WebMail uses this kind of web interface to access your email and parse them to a different layout which looks like your regular phone email app. The data and all secured information is not stored at their server reducing the security concerns faced by organizations and you. It helps in accessing information exactly in the same way like Outlook Web App would do. It’s similar to using Web email in Internet Explorer on a laptop. The IT security issues and protocols do not get affected while using this app. The information synced from your phone to the outlook server is secured.
The downside has some minor bugs that makes you login sometimes as intermittently lose connection. Your email id & settings are stored locally on the phone within the application interface and might require an extra click to login. This extra click on login button is not a big task and a good trade off if you really want your professional emails to be secured.

Get it here on Google Play: OWA Webmail

The above two apps bypass the requirement of 8 digit PIN for Microsoft Exchange on Android locked screens. I am not sure how soon Samsung or Android will address this concern. Their development team need to imitate the security protocol used by iPhone fingerprint scanner. So far the four applications found and highlighted in my previous blogs have got a lot off traffic over Internet and on my blog. The reviews have helped thousands of users across many countries to access their professional emails with ease and without worrying for security teams restricting usage.

Please feel free to leave comment or like my blog.

How to install Windows 10 preview version on VirtualBox

Installing Windows 10 on Surface Pro2 is easy and fast. I used Virtual Box to create a Virtual Machine for Windows 10. The entire process took not more than 10 minutes on my Surface Pro 2. Considering this is only a preview version, I would say the more modified and updated Windows 10 will take a little more time once it’s available. One would not want to install this Preview version on top of your current machines and is not recommended. Going through the Virtual Machine root is the safest way to save your data in case something crashes.

You can download the Technical Preview from here

http://windows.microsoft.com/en-us/windows/preview

 WINDOWS10 (2)

To start Install Virtual Box and create a ‘New’ Virtual Machine.

Name it whatever you feel like.I selected Windows 8.1 as version for 64 Bit for testing purpose

clip_image002

Select how much RAM you want to provide to the Virtual Machine. I randomly selected 3132 MB.

clip_image004

Create a Virtual hard dive:

clip_image006

My preferred way to run VMs is VDI

clip_image008

clip_image010
clip_image012

Following were the final settings of the VirtualBox and VDI

clip_image014

Now, click Start and you will be prompted to select a Virtual Disk file or a Windows 10 Preview CD

clip_image016

Continue reading →