March 2011 Entries

Logparser and Powershell

Logparser in powershell One of the few examples how to use logparser in powershell is from the Microsoft.com Operations blog. This script is a good base to create more advanced logparser scripts: $myQuery = new-object -com MSUtil.LogQuery $szQuery = “Select top 10 * from r:\ex07011210.log”; $recordSet = $myQuery.Execute($szQuery) for(; !$recordSet.atEnd(); $recordSet.moveNext()) { $record=$recordSet.getRecor... write-host ($record.GetValue(0) + “,”+ $record.GetValue(1)); } $recordSet.Close(); Logparser...

Creating a two-way Forest trust with Powershell

Here is a small Powershell script for creating a two-way forest trust. $localforest = [System.DirectoryServices.A... $strRemoteForest = ‘domain.local’ $strRemoteUser = ‘administrator’ $strRemotePassword = ‘P@ssw0rd’ $remoteContext = New-Object System.DirectoryServices.Ac... $strRemoteForest,$strRemote... $remoteForest = [System.DirectoryServices.A... $localForest.CreateTrustRel...

Send on behalf for Multiple users on a mailbox

the following snippet can be used to add more than one user to the grantsendonbehalfto property with Powershell and the Exchange Management Shell get-mailbox dummy |set-mailbox -grantsendonbehalfto “testuser3″ $a = get-mailbox testuser2 | select-object grantsendonbehalfto $b = get-mailbox dummy| select-object grantsendonbehalfto $a.grantsendonbehalfto += $b.grantsendonbehalfto[0] get-mailbox testuser2 |set-mailbox -grantsendonbehalfto $($a.grantsendonbehalfto)...