top of page
Search

(180) Microsoft Intune - Company Portal Shortcut

  • Writer: Mr B SOE way
    Mr B SOE way
  • Oct 16, 2025
  • 1 min read

Updated: Oct 25, 2025

A few months ago before I went on annual leave, a customer wanted to deploy Company Portal as a shortctut on the desktop for end users.


The easiest way I could figure out looks like this:


Install.ps1 will do the following:


[CmdletBinding()]
Param (
   [Parameter(Mandatory=$false)]
   [String]$ShortcutTargetPath,

   [Parameter(Mandatory=$false)]
   [String]$ShortcutDisplayName,

   [Parameter(Mandatory=$false)]
   [Switch]$PinToStart=$false,

   [Parameter(Mandatory=$false)]
   [String]$IconFile=$null,

   [Parameter(Mandatory=$false)]
   [String]$ShortcutArguments=$null,

   [Parameter(Mandatory=$false)]
   [String]$WorkingDirectory=$null
)

#helper function to avoid uneccessary code
function Add-Shortcut {
    param (
        [Parameter(Mandatory)]
        [String]$ShortcutTargetPath,
        [Parameter(Mandatory)]
        [String] $DestinationPath,
        [Parameter()]
        [String] $WorkingDirectory
    )

    process{
        $WshShell = New-Object -comObject WScript.Shell
        $Shortcut = $WshShell.CreateShortcut($destinationPath)
        $Shortcut.TargetPath = $ShortcutTargetPath
        $Shortcut.Arguments = $ShortcutArguments
        $Shortcut.WorkingDirectory = $WorkingDirectory
    
        if ($IconFile){
            $Shortcut.IconLocation = $IconFile
        }
        # Create the shortcut
        $Shortcut.Save()
        #cleanup
        [Runtime.InteropServices.Marshal]::ReleaseComObject($WshShell) | Out-Null
    }
}

#check if running as system
function Test-RunningAsSystem {
    [CmdletBinding()]
    param()
    process{
        return ($(whoami -user) -match "S-1-5-18")
    }
}

function Get-DesktopDir {
    [CmdletBinding()]
    param()
    process{
        if (Test-RunningAsSystem){
            $desktopDir = Join-Path -Path $env:PUBLIC -ChildPath "Desktop"
        }else{
            $desktopDir=$([Environment]::GetFolderPath("Desktop"))
        }
        return $desktopDir
    }
}

function Get-StartDir {
    [CmdletBinding()]
    param()
    process{
        if (Test-RunningAsSystem){
            $startMenuDir= Join-Path $env:ALLUSERSPROFILE "Microsoft\Windows\Start Menu\Programs"
        }else{
            $startMenuDir="$([Environment]::GetFolderPath("StartMenu"))\Programs"
        }
        return $startMenuDir
    }
}


$ShortcutTargetPath5 = "shell:AppsFolder\Microsoft.CompanyPortal_8wekyb3d8bbwe!App"
$ShortcutDisplayName5 = "Company Portal"
$destinationPath= Join-Path -Path $(Get-DesktopDir) -ChildPath "$ShortcutDisplayName5.lnk"
Add-Shortcut -DestinationPath $destinationPath -ShortcutTargetPath $ShortcutTargetPath5
#& ".\CreateDesktopIcon.ps1" -ShortcutTargetPath "shell:AppsFolder\Microsoft.CompanyPortal_8wekyb3d8bbwe!App" -ShortcutDisplayName "Company Portal"


Install behaviour: System Context

Once packaged up and uploaded to Intune, it will show up like this on the desktop












I have attached a video what it looks like


 
 
 

Comments


bottom of page