Invoke-Command -ComputerName PC-0101 -ScriptBlock {
$ShApp = New-Object -ComObject "Shell.Application"
$ShApp.Namespace(17).Items() |
Where-Object { $_.Type -eq "CD Drive" } |
foreach { $_.InvokeVerb("Eject") }
}
Tags
- Active Directory (4)
- Automation (5)
- Lansweeper (1)
- Lync (2)
- Lync Phone Edition (1)
- Performance (1)
- PowerShell (9)
- SCCM 2012 (1)
- SfB (1)
- SQL (1)
- Updates (1)
- Virtualisation (1)
- VMware (1)
Thursday, 30 March 2017
Opening a CD drive using PowerShell
Whether you want the code because April 1st looms large, or because you're trying to show someone at a remote site which desktop they need to do something with, here it is -
Subscribe to:
Posts (Atom)
PerfC Vaccination for ExPetr/Petya/NotPetya Wiper
This is a script I've written to 'vaccinate' our domain against the ExPetr/Petya/NotPetya Wiper. In short, it finds all comput...
-
***Clearing out an old blog, repost from four years ago!*** The Licpath . lic file is the fourth location Autodesk applications look in ...
-
Found a really useful post here on how to add system uptime to your Lansweeper reports. Add the following to your query to add an addition...
-
***Clearing out an old blog, repost from four years ago!*** Managing the adskflex.o pt Options File Options files are created using an...