Sunday, September 5, 2010

2008 multi-homed dns server failing simple query but otherwise works fine

So my dns server was working fine, resolved queries, updated records, etc. But for some reason it kept failing the built in "Simple Query" and "Recursive Query" tests. After much messing around I discovered that it was trying to query the first interface it found. In this case it was the interface that I had manually excluded from the list because I didn't want DNS listening on it. I wound up changing the binding order for the network interfaces to fix the problem. After swapping them around I restarted DNS and voila the built in Monitoring started showing 'Pass" instead of "Fail".

List of interfaces, notice the non-listening one shows up first.

Under Network and Sharing, Advanced Properties, change the bind order.
Restart DNS and try again.

Friday, August 27, 2010

SEP 11.0.6 disabled windows 7 firewall even though NTP was never installed

So I had to help another admin out with a fun issue this week. He had just upgraded his management server to Symantec Endpoint 11.0.6 MR1 and pushed out new clients. He created separate groups for laptops, desktops, etc and separated off the machines he didn't want to install Network Threat Protection on into their own group. The problem was that even though NTP wasn't being installed, it was still disabling the windows firewall (windows 7 in this case) and of course the new security center locked out the ability to reactivate it.

The solution in this case was to turn Inheritence OFF for that group and then withdraw the Firewall policy from that group. After the policy updates it should release the old on Windows Firewall. I didn't have time to stick around for that so we forced the policy update from the client and rebooted the machines for good measure.

1. Uncheck "Inherit policies and settings from parent Group xyz"

2. Click Tasks to the right of "Firewall policy" and Withdraw the policy.

Everything seems to work right afterward. Aside from the inconvenience of having a non-inherited policy to deal with later on when you want to make changes.

In most cases I've found that NTP works a lot better than the older versions like 10.x had so you most likely won't ever need the contents of this post but just in case, have fun.

Tuesday, July 20, 2010

Installing Microsoft System Center Essentials 2010 without it failing

Okay, this was irritating. I started with a brand new fresh Windows 2008 x64 R2 install with all windows updates and the IIS and Application Roles installed. I popped in the DVD for SCE 2010 and rolled along and then it failed. Tried a few more times to no avail. After digging through the forums I found the answer. I had to uncheck the Microsoft Update checkbox! WTF MS? That of all things slipped through QC testing? Afterward it installed fine...



Thanks go out to:
Melissa Poole - http://social.technet.microsoft.com/Forums/en/systemcenteressentials/thread/8c21bd9d-22d5-474a-92a2-f4e51fa2dd44

and Kieranbarnes
http://bloke.org/windows/problems-installing-system-center-essentials-2010/

How to empty a hidden outbox in owa full of junk when outlook doesn't show anything

I have no idea why this happened and I have even less of a clue why they decided to Hide the Outbox folder in OWA 2010. Anyway I had a user whose outbox showed zero items and when we checked the server properties it said that they had 90MB of junk on there. Well, in the old days I'd go into OWA 2k7 and kill them that way. No such luck in OWA 2010.
So my workaround was to turn off the "Cached Mode" and then closed and reopened Outlook.


Now this will force it to look directly at the server and it'll show you the problem Outbox. Delete all the junk from there and wait about 1/2 hour for your server to catch up. Then empty out Deleted Items, kill the OST file, wait a few minutes and then close outlook. Turn Cached Mode back on and you should be back to normal now.

Saturday, June 26, 2010

Converting VMWare server 2.0 images to hyper-V R2

After several attempts with different combination of offline/online conversions, I've finally found a fairly consistent method of converting VMWare Server 2.0 images to Hyper-V R2 images. SCVMM R2 has native support for ESX servers but not the low end free Server 2.0 edition so it requires more effort to get that working.

Software used:
  1. VMWare Server 2.0
  2. Hyper-V R2
  3. SCVMM 2008 R2

Conversion requirements:
Windows 2003 - must have SP2
Windows 2008 preferably at sp1
WinXP should be at SP2/SP3
Vista preferably at SP1
Win7 RTM is fine
Windows 2008 R2 RTM is fine

Step 1:
You must uninstall vmware tools! This has to be done while running the image
on a vmware product (i.e. server, workstation, player). Just go into Add/Remove programs and remove it from there. I can't stress enough how important it is to get this uninstalled before conversion.
Note: By doing this, the machine will lose it's static IP settings if one is set.

Step 2:
Copy image to SCVMM R2 library folder
Wait a few minutes for SCVMM to refresh the library.

Step 3:
From the library view in SCVMM, right click on the VM and choose Convert Virtual.
From there follow the wizard.



Step 4:
After conversion occurs, go into the settings for the image in the Hyper-V console and confirm that a network card has been assigned. If not, add one. The first time you boot you may find that some services fail because the network card hasn't been detected yet. This should go away on the next reboot after you add the network card.



Step 5:
Boot the new image. Log into it and install the Integration components if they are missing.



Step 6:
Test to make sure your newly converted image is working properly.

Optional Step 7:
Compact the newly created VHD disks. This can free up a lot of wasted space. If you started with Static sized disks, the conversion process will have converted them to Dynamic sized disks. In Hyper-V R2 they supposedly fixed a lot of performance differences for dynamic vs static so it should be fine.



Now you should be all done.

Thursday, June 3, 2010

PHP - trimming off characters after the last slash in a URL

I really don't like programming. But every once in a while you've got to break down and do it for special projects. Recently I had to write some PHP code for a specific situation where I needed to be able to take the current URL the script was running at, strip out the script name, strip out the last slash and the directory name that proceeded it. Effectively, I was simulating ../ on the path because security requirements were getting in the way of a script. I played around with rtrim(), dirname(), regular expressions, etc but just wasn't quite getting the result that I wanted. My script determines the current URL, explodes it into a string array spliced at each slash character, then builds the new URL in a loop. You can tweak the iterations of the loop for however many directory levels back you want to go.

<?php
# Using SCRIPT_NAME

$path = $_SERVER['SCRIPT_NAME'];
$path2 = "/";
$domain = $_SERVER['HTTP_HOST'];

#echo "current path: " .$path . "<br>";
$parts = explode("/",$path); // splice by slash

$i=1; // skip zero cuz it's empty
$endi = count($parts) - 2; // number of parts minus 2 hierarchy

while ($i < $endi) {
$path2 = $path2 . $parts[$i] . "/";
$i++;
}
$temp = 'http://' . $domain . $path2;
echo $temp;

?>



Example:
If you run the above code and your original URL was http://www.test.com/blue/test.php
the output would be http://www.test.com/

Monday, May 3, 2010

Exchange 2010 Powershell Script - Email owners of all email distribution groups

Updated for exchange 2010. Enumerates all distribution groups, then emails the owner of each group a list of group members per distribution list.

# Enumerates a list of all members of all Distribution Lists
# in Exchange 2010.
# Script will then proceed to email each owner a list of all
# members of each group.
#
# Use PowerShell.exe -command
# ". 'D:\Program Files\Microsoft\Exchange Server\V14
#\bin\RemoteExchange.ps1';
# Connect-ExchangeServer -auto; path_to_your_script"
#
# Updated 5/02/10
# By: Gnawgnu

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

#first get all distributionlists
$dl = get-distributiongroup

#then enumerate through them all and get all group members.
foreach ($group in $dl) {

#build group data
$groupName = "Group Name: " + $group.name
$groupAddr = "Email Address: " + $group.PrimarySMTPAddress
write-host $groupName -foregroundcolor Green
$dlgm = get-distributionGroupMember $group.name.ToString()

# grab the first owner from the multivalued property
$gOwner = get-user -Identity $group.ManagedBy[0]

#setup email - make sure to add to your whitelist for
#antispam if applicable.
$sender = "PickASMTPSenderEmailAddress"
write-host $sender
#get Email Address of group owner
$recipient = $gOwner.WindowsEmailAddress
write-host $recipient
$server = "YourSMTPServerGoesHere"
write-host $server
$subject = "Monthly Review required - Email Group: " + $group.Name.ToString()
write-host $subject
#Note: `r`n is a carriage return
$bText1 = "`r`nOwner:" + $gOwner.Name + "`r`n"
$bText2 = $groupAddr.ToString() + "`r`n"
$bText3 = "group members: `r`n"
$bText4 = $dlgm | fl Name | out-String
$bText5 = "Please use your Outlook Client to make changes if needed.`r`n"
$bText6 = "If you are no longer the manager of this group, blah.`r`n"

$body = $bText1 + $bText2 + $bText3 +$bText4 +$bText5 +$bText6
write-host $body.ToString()
$msg = new-object System.Net.Mail.MailMessage $sender, `
$recipient, $subject, $body

#send email
$client = new-object System.Net.Mail.SmtpClient $server
$client.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$client.Send($msg)

}

Old post:
http://gnawgnu.blogspot.com/2008/03/exchange-2007-powershell-script-emails.html

Exchange 2010 - email list of all distribution groups, members, and owner

I recently had to update a script that I used to use in exchange 2007 that no longer works in 2010. It's mainly due to powershell changes and a tricky issue with getting the owner field back out. Anyway, this script cycles through all your email distribution groups, then emails a list of all of them, the members of each, and the owner to the email distribution group. It's similar to an old script I had back in 3/08.

Updated Note: You can also use
# grab the first owner from the multivalued property
$gOwner = get-user -Identity $group.ManagedBy[0]
instead to get the group owner property and then just use that .Name property for string ouput.


# Enumerates all members of all Distribution Lists in Exchange 2010.
# Use PowerShell.exe -command ". 'D:\Program Files\Microsoft\Exchange
# Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer
#-auto; replacewithyourscriptfilenameandpath"

# Script will then proceed to email a list of all
# members of each group
# Updated 5/02/10
# By: Gnawgnu

# this part is new for 2010
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

#first get all distributionlists
$dl = get-distributiongroup

# initialize variables
$recipient = "PickARecipientEmailAddress"
$sender = "PickASMTPSenderEmailAddress"
$subject = "Monthly Summary of Email Groups"
$server = "YourSMTPServerGoesHere"
$gOwner = "blankstring"

#prepare and output file
$currDate = get-date
#path must exist
write-host "Email groups as of: " $currDate | out-file 'c:\temp\emailgroupmembers.txt'


#then enumerate through them all and get all group members.
foreach ($group in $dl) {

$groupName = "-------------" + "`r`n" + "Group Name: " + $group.name
write-host $groupName -foregroundcolor Green
# this part joins the results of that field into one string.
$gOwner = $group.ManagedBy | `
Select @{Name='Name';Expression={[string]::join(";", ($_.Name))}}
write-host "Owner: " $gOwner -foregroundcolor Green
$groupName | out-file -append 'c:\temp\emailgroupmembers.txt'
$group.ManagedBy.Name | out-file -append 'c:\temp\emailgroupmembers.txt'
$groupAddr = "Email Address: " + $group.PrimarySMTPAddress
$dlgm = get-distributionGroupMember $group.name.ToString()
$dlgm | fw | out-file -append 'c:\temp\emailgroupmembers.txt'

#Note: `r`n is a carriage return
$bText0 = "-------------" + "`r`n" + "Group Name: " + $group.Name
$bText1 = "`r`nOwner:" + $gOwner + "`r`n"
$bText2 = $groupAddr.ToString() + "`r`n"
$bText3 = "`r`n" + "group members: `r`n"
$bText4 = $dlgm | fl Name | out-String
$bTextFinal = $bText0 + $bText1 + $bText2 + $bText3 +$bText4

$body = $body + $bTextFinal
}

$msg = new-object System.Net.Mail.MailMessage $sender, $recipient, $subject, $body

#send email
$client = new-object System.Net.Mail.SmtpClient $server
$client.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$client.Send($msg)

To call it from a batch file: (avoid long path names, spaces, etc)
PowerShell.exe -command ". 'D:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; D:\Exch2010enum.ps1"