powershell

Eject a CD/DVD Drive with Powershell

Here's a quick Powershell script to eject all CD/DVD drives on a computer.  This uses the WMPlayer COM object.

 

$wm = New-Object -ComObject "WMPlayer.ocx"

$drives = $wm.cdromCollection

for($i = 0; $i -lt $drives.Count; $i++)

{

    $drives.Item($i).Eject()

}

 

Feedback is always welcome.  Enjoy!

Change DNS Servers Remotely with Powershell

At some point most admins will need to change a DNS server (or two) on their network.  This is an easy change for DHCP clients, but can be a real pain for statically assigned clients.  Below is a simple Powershell script that runs through a list a computer names and updates the DNS servers on the clients.

 

Syndicate content