Category Archive: PowerShell

Nov 13 2015

Using Set-VMNetworkAdapterVlan with clustered VMs

I recently needed to assign VLANs to a group of virtual machines on a Hyper-V cluster, tried to use the Set-VMNetworkAdapterVlan  cmdlet directly only to find that it needs the current host of each VM to work, so here’s a small script to get it done. The script select only VMs where no VLAN is …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2015/11/using-set-vmnetworkadaptervlan-with-clustered-vms/

Sep 22 2015

Delete phantom records of an old domain controller from DNS

Sometimes after demoting a DC the NS records in DNS are kept! These records may cause issues if not deleted. Here’s a PowerShell three liner to remove the obsolete records from all zones, you need to change the server names according to your environment.  

  Cheers!

Permanent link to this article: http://almoselhy.azurewebsites.net/2015/09/delete-phantom-records-of-an-old-domain-controller-from-dns/

Dec 21 2014

Compare contents of two folders using PowerShell Get-FileHash

I needed to check that two folders are identical using a hash algorithm. Luckily enough, PowerShell 4.0 came equipped with a new cmdlet, Get-FileHash. This easy command can produce a hash for any file using an array of different algorithms. One issue is when comparing with, Compare-Object, the difference in folder paths will be an …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2014/12/compare-contents-of-two-folders-using-powershell-get-filehash/

Nov 27 2014

Collect installed updates on many computers using PowerShell

I wanted to collect the currently installed updated on a group of servers using PowerShell. This can be more accurate that WSUS or SCCM reports since it depends on WIM to get the current data, not the last reported ones. The – very small – script gets the computer objects from active directory, then use …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2014/11/collect-installed-updates-on-many-computers-using-powershell/

Nov 18 2014

Header name in Exchange Transport Rules

If you need to create a new Transport Rule that checks the message header, either through Exchange Admin Center or Exchange Management Shell, you need to provide what is stated as Header Name in the GUI. After some looking around, I found that the header is actually the header field name. So for example, if you …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2014/11/header-name-in-exchange/

Nov 12 2014

Using PowerShell ISE on an Exchange Edge Transport Server

I’ve been looking for a way to use ISE on an Edge Transport server in order to write some scripts. Finally I found that it is easier than I imagined! You just need to run the cmdlet below, I tested it on Exchange 2013 (CU6). I don’t know why it states 2010 Snapin name

  …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2014/11/using-powershell-ise-on-an-exchange-edge-transport-server/

Nov 12 2013

Automatically upload files to FTP server(s) using PowerShell

In the honor of taking a week off, I decided to share with you a script I’ve been asked to work on recently that automatically uploads a list of files to multiple FTP servers. Since I couldn’t find any native commands in PowerShell to work with FTP (Please leave comments if you know any), I …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2013/11/automatically-upload-files-to-ftp-servers-using-powershell/

Jun 15 2013

How to deal with SCOM fragmentation alerts?

Have you just installed the Windows Server Management Packs only to find that next Saturday a flood of warnings saying that your drives’ fragmentation levels are high? Well, here is how to deal with this monitor. But first, understand that this monitors runs a check every Saturday at 3:00 AM by default, and running the …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2013/06/how-to-deal-with-scom-fragmentation-alerts/

Jul 23 2012

Remove all send-as permissions a user has in the exchange organization

Send-As allows a user to send emails as someone else. A feature that comes in handy under many circumstances, such as an assistant sending Christmas greetings instead of her boss. Adding Send-As permissions to a user is usually a straight forward task in Exchange. But finding all the Send-As permissions a user has on all …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2012/07/remove-all-send-as-permissions-a-user-has-in-the-exchange-organization/

Dec 16 2011

Remove unused computer accounts from Active Directory using PowerShell

I can never call myself a PowerShell guru, but I am currently trying my best to “practice” more PowerShell since I know that it is the future of command line administration. So today, I was doing some regular maintenance to the active directory, just disabling the old computer accounts as a step into removing them …

Continue reading »

Permanent link to this article: http://almoselhy.azurewebsites.net/2011/12/remove-unused-computer-accounts-from-active-directory-using-powershell/

» Newer posts