16 Jun 2011 @ 4:55 PM 

I wrote a Powershell script today that moves a mailbox and then resets its AD permissions (To fix ActiveSync issues after moving from Exchange 2007 to Exchange 2010). Just thought i’d share it.

#© Daniel Stone, 2011 daenks at daenks dawt org
param([string]$Source, [string]$Destination)
if (!$Source) {
Write-Host “Please Specify a Source Store with the -Source parameter”
Exit -1
}
if (!$Destination) {
Write-Host “Please Specify a Destination Store with the -Destination parameter”
Exit -2
}

$i = 0
$ds = New-Object System.DirectoryServices.DirectorySearcher([ADSI]”LDAP://dc=quintanaminerals,dc=com”)
$Moves = Get-Mailbox -Database $Source
foreach ($mailbox in $Moves) {
$i = $i + 1
Write-Host $i
if ($i -eq 14)
{
Write-Host “15 Mailbox Limit Exceeded. Please allow the first 15 moves to complete before starting more.”
Exit -3
}
New-MoveRequest -Identity “$($mailbox.DisplayName)” -TargetDatabase $Destination
$ds.Filter = “(&(objectCategory=person)(objectClass=user)(cn=$($mailbox.DisplayName)))”
$DSResults = $ds.FindAll()
foreach ($item in $DSResults) {
$user = $item.GetDirectoryEntry()
Write-Host “Correcting Permissions for: $($user.sAMAccountName)”
$user.psbase.ObjectSecurity.SetAccessRuleProtection($false,$true)
$user.psbase.CommitChanges()
}
}
#© Daniel Stone, 2011 daenks at daenks dawt org

I realize there are some improvements that i could make, like a LOT more error checking. But this will do for me for now 🙂

Oh yea, and WordPress messed up the indentation, sorry 🙂

Posted By: Daenks
Last Edit: 16 Jun 2011 @ 04:58 PM

EmailPermalinkComments (0)
Tags
 27 Oct 2009 @ 8:34 AM 

I was looking at my Google Analytics account and realized i am getting alot of hits for the keywords “ESX 4.0 RDM greyed out” which i briefly questioned in a previous post. The answer to this is simple, to be a `supported` Raw Device Mapping (RDM!) you need an available and unformatted LUN (SCSI, iSCSI, Fibre Channel etc.) to map to a .vmdk file.

As i pointed out in a previous post, it is rather easy to create an RDM manually via command line:

esxcfg-scsidevs -l

Output:

t10.ATA_____SAMSUNG_HD502HI_________________________S1VZJDWS462094______
 Device Type: Direct-Access
 Size: 476940 MB
 Display Name: Local ATA Disk (t10.ATA_____SAMSUNG_HD502HI_________________________S1VZJDWS462094______)
 Plugin: NMP
 Console Device: /dev/sda
 Devfs Path: /vmfs/devices/disks/t10.ATA_____SAMSUNG_HD502HI_________________________S1VZJDWS462094______
 Vendor: ATA       Model: SAMSUNG HD502HI   Revis: 1AG0
 SCSI Level: 5  Is Pseudo: false Status: on
 Is RDM Capable: false Is Removable: false
 Is Local: true
 Other Names:
 vml.01000000005331565a4a44575334363230393420202020202053414d53554e

The above output was truncated to focus on the disk I am creating a RDM for, but that command will list ever disk and its detailed information; and is new to ESX 4.0. So now that I have my drive identifiers, I can create an RDM like this:

vmkfstools -r /vmfs/devices/disks/t10.ATA_____SAMSUNG_HD502HI_________________________S1VZJDWS462094______ /vmfs/volumes/Shared_Storage/VCB/External.vmdk

OR

vmkfstools -r /vmfs/devices/disks/vml.01000000005331565a4a44575334363230393420202020202053414d53554e /vmfs/volumes/Shared_Storage/BCB/External.vmdk

Either way will accomplish the same thing, as any disk identifier can be used. In theory, i could just use “/dev/sda” as well. Regardless, I now have a .vmdk file which I have attached to my VM.

RDMs are extraordinarily easy to create, however, i should re-iterate that creating RDMs to storage devices that are not shared resources can cause HA/DRS/FT issues.

-D

Posted By: Daenks
Last Edit: 27 Oct 2009 @ 08:34 AM

EmailPermalinkComments (0)
Tags
Categories: Administration
 27 Oct 2009 @ 8:19 AM 

Hey all, recently I was transferred to a new full-time client here in Houston, and I have some interesting adventures in the works! This company has offices in Houston, China, Singapore, and Brazil; and I am going to be assisting in the setup of the IT Infrastructure in the Singapore office within the next month or two. There will be many lessons and adventures to talk about soon, stay tuned!

-D

Posted By: Daenks
Last Edit: 27 Oct 2009 @ 08:19 AM

EmailPermalinkComments (0)
Tags
 10 Jun 2009 @ 9:26 PM 

Welcome to my blog. I’ve been meaning to chronicle my adventures for some time now, and for whatever reason I gathered the motivation to begin today.

Posted By: Daenks
Last Edit: 06 Jul 2009 @ 03:19 PM

EmailPermalinkComments (0)
Tags
Tags: , ,
Categories: Administration

 Last 50 Posts
Change Theme...
  • Users » 727
  • Posts/Pages » 8
  • Comments » 0
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.