It-afdelingen A/S jyllands afdelingen, er nu flyttet til Silkeborg
Monthly Archives: May 2012
Lost trust on my Exchange 2010 after revert to a older snapshot
I was returing to an older snapshot of my Exchange servers. But when i want to logon to the Exchange server, it came with “Trust relationship has been lost with domain controller”.
Normally you just rejoin the domain, but this is not a good idea, when there is installed Exchange services on it.
I fix this with netdom.
Logon to the Exchange with a locally logon account.
Start command with Administrator rights
Type: netdom /RESETPWD /server:DOMAINCONTROLLER /UserD:DOMAINNAME\ACCOUNTNAME /PasswordD:PASSWORD OR *
Exchange 2010, show permission on all folders in all mailboxes
Here is a script, that runs though you Exchange server, and return all permission on all folders in all mailboxes.
The script needs to be running from the Exchange management Shell, and will create a subfolder in c:\ call ExchangeMailboxPermission, where it will create a text file for all yours mailboxes.
#This script will return all permissions on all folders #in all mailboxes # #Written by Kenneth Dalbjerg - http://www.kennethdalbjerg.dk # $FolderPath = 'C:\ExchangeMailboxPermission\' if ((Test-Path -path $FolderPath) -ne $True) { New-Item $FolderPath -type directory } $mailboxes = get-mailbox -resultsize unlimited foreach ($mailbox in $mailboxes) { $alias = $mailbox.DistinguishedName $username = $mailbox.SamAccountName $SpecialExchangeFolders = "Top of Information Store|Recoverable Items|Deletions|Purges|Versions" $mailboxfolderes = Get-MailboxFolderStatistics -folderscope all -identity $alias | where { $_.name-notmatch $SpecialExchangeFolders } $File = $FolderPath + '\' + $username + '.txt' $mailboxfolderes | foreach { $folder = $username + ':' + $_.folderpath -replace "/","\" echo $folder Get-MailboxFolderPermission -identity $folder } | Out-file $File }
Exchange 2010, powershell full access and send-as permission
To get a CSV file, from you exchange with full access and send as permission, from all you mailboxes run these commands:
Full Access
Get-Mailbox | Get-MailboxPermission | where {$_.user.tostring() -ne “NT AUTHORITY\SELF” -and $_.IsInherited -eq $false} | Select Identity,User,@{Name=’Access Rights’;Expression={[string]::join(‘, ‘, $_.AccessRights)}} | Export-Csv -NoTypeInformation c:\mailboxpermissions.csv
Send As
Get-Mailbox | Get-ADPermission | where { ($_.ExtendedRights -like “*Send-As*”) -and ($_.IsInherited -eq $false) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | Select Identity, User, Deny | Export-CSVc:\sendas.csv
Revert to snapshot causes virtual machine to be suspended
Error:
host cpu is incompatible with the virtual machine’s requirements at cpuid level 0x1
Details
- The virtual machine becomes stuck in a suspended state after performing a Revert to Snapshot operation
- If you try to remove the virtual machine from its suspended state, you see the error:
Error: error encounter trying to restore cpu state from file.
Solution
- Ensure that the virtual machine is not running another process.
- Unregister the virtual machine.
- Open the .vmx file in a text editor.
- Remove the checkpoint.* lines from the file.
- Save and close the file.
- Re-register the virtual machine.
The virtual machine is in a powered off state. You can now power it on.
Citrix Provisioning Server “An unexpected MAPI error occurred.” when you try to change an image mode
When you change the mode from private to standard, you may get this error: “An unexpected MAPI error occurred.”. If you click on “More details”, there stand: ”Failed to map vDisk, no Driver.”.
The solution to this problem could be, changing the the Microsoft Volume Licensing, from KMS to ether None og MAK. And then push the OK buttom. If its work you can just change the Microsoft Volume Licensing back to KMS.
Delete mails from a sender or to recipient address
Here is a simple script “pfdel” that can be use to delete a mail from a sender or recipient address.
Save the perl script as pfdel in /usr/local/bin and chmod +x /usr/local/bin/pfdel
Then you can use the perl script as: pfdel [email protected] then it will delete all messages where ether [email protected], is in there sender or recipient address.
#!/usr/bin/perl -w
#
# pfdel – deletes message containing specified address from
# Postfix queue. Matches either sender or recipient address.
#
# Usage: pfdel
#
use strict;
# Change these paths if necessary.
my $LISTQ = “/usr/sbin/postqueue -p”;
my $POSTSUPER = “/usr/sbin/postsuper”;
my $email_addr = “”;
my $qid = “”;
my $euid = $>;
if ( @ARGV != 1 ) {
die “Usage: pfdel \n”;
} else {
$email_addr = $ARGV[0];
}
if ( $euid != 0 ) {
die “You must be root to delete queue files.\n”;
}
open(QUEUE, “$LISTQ |”) ||
die “Can’t get pipe to $LISTQ: $!\n”;
my $entry = ; # skip single header line
$/ = “”; # Rest of queue entries print on
# multiple lines.
while ( $entry = ) {
if ( $entry =~ / $email_addr$/m ) {
($qid) = split(/\s+/, $entry, 2);
$qid =~ s/[\*\!]//;
next unless ($qid);
#
# Execute postsuper -d with the queue id.
# postsuper provides feedback when it deletes
# messages. Let its output go through.
#
if ( system($POSTSUPER, “-d”, $qid) != 0 ) {
# If postsuper has a problem, bail.
die “Error executing $POSTSUPER: error ” .
“code ” . ($?/256) . “\n”;
}
}
}
close(QUEUE);
if (! $qid ) {
die “No messages with the address ” .
“found in queue.\n”;
}
exit 0;
Show number of mails in queue
To show the number of mail in a Postfix queue, you can use this command:
postqueue -p | tail -n 1 | cut -d' ' -f5