Powershell outputs the string instead of executing command.
$apps = @()
$apps += Get-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" # 32 Bit
$apps += Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
$apps365 = $apps | Where-Object {$_.DisplayName -Match "365" | Sort-Object DisplayName}
$uninPaths = @()
foreach ($item in $apps365) {
$uninPaths += "& CMD /C "+$item.UninstallString
}
Invoke-Command -ScriptBlock{$uninPaths}
cmd.exe? Usually the unistall string is a standard executable file which often accepts one or more arguments/parameters. They do not need to be exectuted in that specific CLI interface. Why not just try it directly in the PowerShell CLI interface, you're already using?