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 - 



       

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") }
 }

       
 

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...