# bulk uninstall software

**URL:** <https://forums.powershell.org/t/bulk-uninstall-software/11041>\
**Category:** PowerShell Help\
**Created:** [July 26, 2018, 2:18am UTC](https://forums.powershell.org/t/bulk-uninstall-software/11041 "2018-07-26T02:18:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![barbarbarero](https://avatars.discourse-cdn.com/v4/letter/b/a3d4f5/32.png) [@barbarbarero](https://forums.powershell.org/u/barbarbarero)\
**Post date:** [July 26, 2018, 2:18am UTC](https://forums.powershell.org/t/bulk-uninstall-software/11041/1 "2018-07-26T02:18:21Z")

</div>

hello guys …  
im trying to uninstall a software " oracle virtualbox " so i made a simple powershell script

```
Invoke-Command -ScriptBlock {Get-CimInstance -ClassName Win32_Product -ComputerName (Get-Content D:\Powershell\Computernames.txt) -Filter "name like '%virtualbox%'" | Remove-CimInstance -Verbose}
```
 ... but for some reason it only works if im logged on to the remote pc via Remote desktop ... though the -verbose shows that its performing some actions 
```
VERBOSE: Perform operation 'Delete CimInstance' with following parameters, ''namespaceName' = root/cimv2,'instance' = Win32_Product: Oracle VM VirtualBox 5.1.
22 (IdentifyingNumber = "{8D5E4D4D-5E0C-4448-B018-5DDEF1E208D9}", Name = "Oracle VM VirtualBox 5.1.22", Version = "5.1.22")'.
VERBOSE: Performing the operation "Remove-CimInstance" on target "Win32_Product: Oracle VM VirtualBox 5.1.22 (IdentifyingNumber = "{8D5E4D4D-5E0C-4448-B018-5D
DEF1E208D9}", Name = "Oracle VM VirtualBox 5.1.22", Version = "5.1.22")".
VERBOSE: Perform operation 'Delete CimInstance' with following parameters, ''namespaceName' = root/cimv2,'instance' = Win32_Product: Oracle VM VirtualBox 5.1.
22 (IdentifyingNumber = "{8D5E4D4D-5E0C-4448-B018-5DDEF1E208D9}", Name = "Oracle VM VirtualBox 5.1.22", Version = "5.1.22")'.
VERBOSE: Operation 'Delete CimInstance' complete.
VERBOSE: Operation 'Delete CimInstance' complete.
VERBOSE: Operation 'Delete CimInstance' complete.
```

any help please ?

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [July 26, 2018, 7:59am UTC](https://forums.powershell.org/t/bulk-uninstall-software/11041/2 "2018-07-26T07:59:55Z")

</div>

This is not a Pester question. Moving to the correct forum.

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [July 26, 2018, 8:01am UTC](https://forums.powershell.org/t/bulk-uninstall-software/11041/3 "2018-07-26T08:01:10Z")

</div>

Many installers are badly made and won’t work without a full user profile; PowerShell Remoting does not create a full user profile. Short of repackaging the software into a better installer, there’s not much you can do about that.

---

<div class="post-metadata">

**Author:** ![postanote](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@postanote](https://forums.powershell.org/u/postanote)\
**Post date:** [July 26, 2018, 10:41am UTC](https://forums.powershell.org/t/bulk-uninstall-software/11041/4 "2018-07-26T10:41:22Z")

</div>

How was the software installed?

Why not copy your script to a shared location, and set it as a RunOnce option on the users systems?  
Why not remotely create a scheduled task, which runs once at user logon, to remove the software?  
If the software was install via a tool like SCCM then use SCCM to remove it?  
If the software was installed using GPO, then it can be removed with GPO?

How about changing this up a bit.

```
Get-Content 'D:\Powershell\Computernames.txt' %{
"Processing actions on $_"
Invoke-Command -ComputerName $_ -ScriptBlock {Get-CimInstance -ClassName Win32_Product -Filter "name like '%virtualbox%'"}
}
```

Also, Win32\_Product can be very slow and has other issues…

> 'gregramsey.net/2012/02/20/win32\_product-is-evil'
> 
> ‘[powershell.org/forums/topic/alternatives-to-win32\_product](http://powershell.org/forums/topic/alternatives-to-win32_product)’

… so, depending on your scenario, it’s best to use an alternative.

---

<div class="post-metadata">

**Author:** ![barbarbarero](https://avatars.discourse-cdn.com/v4/letter/b/a3d4f5/32.png) [@barbarbarero](https://forums.powershell.org/u/barbarbarero)\
**Post date:** [July 26, 2018, 11:07pm UTC](https://forums.powershell.org/t/bulk-uninstall-software/11041/5 "2018-07-26T23:07:27Z")

</div>

the software was installed one by one pc … i will try your suggestions thanks

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/bulk-uninstall-software/11041/6 "2024-05-16T20:34:40Z")

</div>

Closed on May 16, 2024, 8:34pm UTC


