Month: July 2014

How to setup send-as permission on a mail-enabled Distribution group

Posted on Updated on

You can add send-as permission on a mail-enabled Distribution group by going to Active Directory.

1.  Open the properties of the group object you would like to add send-as permission

2.  Under Security, add the user or user group you want send-as permission to work

3.  Under the permissions window, allow ‘Send-as’ by checking on the box

 

To verify if the changes took effect, open Exchange PowerShell and run the command;

get-distributiongroup “name of distro group” | get-adpermission | where {($_.ExtendedRights -like “*Send-As*”)}

 

Please note:  The AD changes might take a while to replicate to the whole domain, depending on how large your organization is.  Users may also need to re-login to their computers before they can start sending emails in behalf of the distribution group.

Remove SoftDeleted Mailboxes after a move

Posted on Updated on

Most of the time, when a mailbox is moved from a database to another, the system is unable to delete the mailbox from the source database.  Often, you will find a Move Request status of ‘Completed with warning‘ with details:

Warning: Failed to clean up the source mailbox after the move.
Error details: MapiExceptionUnexpectedMailboxState: Unable to delete mailbox. (hr=0x80004005, ec=2634)

Below are the commands you can use to safely list and delete the mailboxes from the old database location.

List all disconnected mailboxes in a database

Get-MailboxStatistics -Database “Database Name” | Where-Object {$_.DisconnectDate -Notlike $NULL} | Format-Table DisplayName, DisconnectDate, MailboxGuid, DisconnectReason -Wrap

Remove all SoftDeleted disconnected mailboxes from a database

$Mailboxes = Get-MailboxStatistics -Database “database name” | where {$_.DisconnectReason -eq “SoftDeleted”} $Mailboxes | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

How to remove Ghosted mailboxes

Posted on Updated on

Ghosted mailboxes sometimes appear after a mailbox move on the source database.  The move request will have a status ‘Completed with warning’ and the status log will have something like “Failed to clean up the source mailbox “<SID>” after the move”.

To find the disconnected mailboxes,

Get-MailboxStatistics -Database “DATABASE NAME” | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid

To dump it to a CSV, add the command “| Export-CSV dump.csv” at the end of the script above

To find an individual mailbox that is in this state based on its GUID,

Get-MailboxStatistics -Database “DATABASE NAME” | Select displayname, MailboxGUID, Mailbox, DatabaseName | Where-Object { $_.MailboxGUID -eq “GUID”}

To successfully remove the Ghosted mailbox, run the following command

Remove-Mailbox -Database “DATABASE NAME” -StoreMailboxIdentity GUID

Update:  If you are getting a message that says the mailbox GUID does not exist on the database, you may try running the ‘Remove-StoreMailbox’ commandlet.  An example of the script is below

Remove-Storemailbox -database <database Name> -identity <Mailbox GUID> -mailboxstate SoftDeleted

Get-MailboxStatistics -Database “databasename” -OutBuffer 1000 | ? {$_.DisconnectReason -eq “SoftDeleted”} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

How to fix single sign-on when it stops working

Posted on Updated on

Sometimes this happens.  All of a sudden single sign-on no longer works on your web application.  In my case I was able to fix this by moving NTLM authentication to the top of the list in IIS.

Here are the procedures:

1.  Open IIS and select your default website

2.  Click ‘Authentication’ and right-click on ‘Windows Authentication’

3.  Select ‘Providers’ and move NTLM to the top

How to setup FTP on IIS 7.5

Posted on Updated on

Create an IIS 7.5 FTP site (Windows Server 2008 R2)

Part 1: Create a basic FTP site

1.  Create a new user for the FTP site

1.  Open Server Manager

2.  Go to Configuration > Local Users and Groups > User

3.  From the Actions pane select More Actions > New User…

4.  Enter the username and password that you want to use for this FTP site

5.  Uncheck – User must change password at next logon

6.  Check – User cannot change password

7.  Check – Password never expires

8.  Click Create and then the Close button.

9.  Open the user properties of the user you created above (double-click or right-click > Properties on the username in Server Manager)

10.  Go to the Remote Desktop Services Profile tab

11.  Check – Deny this user permissions to log on to Remote Desktop Session Host server

12.  Click OK

13.  Close Server Manager

2.  Launch Internet Information Services (IIS) Manager. This is found by clicking the “Start button” > Administrative Tools > Internet Information Services (IIS) Manager.

3.Expand the tree view (left pane in IIS Manager) under the Connections pane – click the ‘+’ next to the server name – and select Sites.

4.From the Actions pane select “Add FTP Site”

5.Complete the Add FTP Site wizard.

1.FTP site name: The name you wish to give this FTP site

2.Physical path: The location of your site or where you want the FTP site files to go

3.Click Next

4.Set the IP address that you want to use for FTP

5.Select Allow SSL

6.Choose the self-signed, server generated certificate from the SSL Certificate: drop-down list

7.Click Next

8.Check Basic authentication

9.Change the Allow access to: drop-down to Specified users

10.Enter the name of the user that you previously created in the text area below the drop-down list

11.Check Read and Write from Permissions

12.Click Finish

6.You should now see the name of your FTP site under the main Sites pane

7.Double-click on the FTP site that you setup from the main pane, or expand Sites from the tree view and select the FTP site that you setup

8.Check folder permissions on the folder that you pointed the FTP site to

1.Click Edit Permissions… under the Actions pane

2.Click Security tab

3.Make sure the user that you created above has modify rights to the folder

9.At this point FTP is setup and working using the most basic configuration.

Part 2: User Isolation

Note: There are five types of FTP User Isolation that IIS7.x supports. In this KB article we will only cover two: “FTP Root Directory” which is the basic, default option and “User name directory (disable global virtual directories)” which is used for user isolation. If you would like information on all five types of FTP User Isolation you can look here: http://learn.iis.net/page.aspx/305/configuring-ftp-75-user-isolation/#002

1.With the FTP site that you created above selected in the IIS Manager, launch the FTP User Isolation module by clicking on the FTP User Isolation icon

2.Change the isolation method from “FTP root directory” to “User name directory (disable global virtual directories)”

3.Click Apply under the Actions pane.

4.Go back to the root of your FTP Site.

5.Create a virtual directory named LocalUser.

Note 1: This is one of the rare cases where Windows requires case-sensitivity. The virtual directory name must be LocalUser, with the capital “L” and “U”, or FTP user isolation will fail.

Note 2: The LocalUser folder only works for server level (local) usernames. Domain level usernames are covered in later steps.

1.Right-click on Test FTP Site from the tree view and select Add Virtual Directory…

2.Alias: LocalUser (case-sensitive!)

3.Physical path: C:\inetpub\ftproot

4.Click OK

6.Now create a second virtual directory (vdir) under the LocalUser vdir.

1.Right-click on LocalUser from the tree view and select Add Virtual Directory…

2.Alias: Use the name of the user that you created above for FTP

3.Physical path: The actual path to where you want this user to be directed to

4.Click OK

7.Select the vdir in step 6 above from the tree view then Edit Permissions… from the Actions pane. 8.Under the Security tab, give your FTP user “Modify” permissions to the folder then OK out of everything.

For a domain user, follow the steps below:

1.In IIS Manager, create a new vdir under the root of your FTP Site named OW.

Note 1: When setting up user isolation for domain user names you must create a vdir using the domain’s nickname. This directory acts in the same way LocalUser does but for domain level users.

Note 2: An Active Directory domain has two names: the domain name and the nickname. The nickname is actually the “pre-Windows 2000 domain name” from when the domain names did not use a DNS/LDAP like naming structure.

The post-Windows 2000 domain names are like an internet domain name, like orcsweb.com. The pre-Windows 2000 domain name, or nickname, is just a single word with hostname like attributes. In OrcsWeb’s case the nickname is OW, and the domain name is orcsweb.com.

1.Right-click on your FTP Site from the tree view and select Add Virtual Directory…

2.Alias: OW (all upper case)

3.Physical path: C:\inetpub\ftproot

4.Click OK

2.Now create a second and third virtual directory (vdir) under the OW vdir.

1.Right-click on the OW vdir from the tree view and select Add Virtual Directory…

2.Alias: <your domain user name> (without the OW\ in front if it)

3.Physical path: The path to your site

4.Click OK

5.Repeat for any other users as needed.

3.Add the user to the NTFS permission on disk for the folders that you pointed the FTP users to 4.Authorize the domain users in FTP.

1.In IIS Manager, select your FTP Site and then the FTP Authorization Rules module

2.Here is where you can authorize users to access the FTP site.

There are a couple of options you can choose:

1. Add the individual users or groups,

2. Allow all authenticated users. By default we add individual users or a user group when setting up isolated users.

3.Add any domains users to the existing rule (if there are any – or create a new one).

1.Select the rule then Edit from the Actions pane

2.After existing user enter a comma-space (“,  “) then OW\ and the Active Directory user name.

3.Click OK

Fix Temporary Profile

Posted on Updated on

When a profile is not deleted correctly from a computer, the user(s) may have difficulties logging in correctly.  Most of the time, user(s) are logged in with temporary profiles.  Here is a way to fix this via registry.

Open the registry by launching regedit.exe from ‘run’.

WARNING!!! Improper use of the registry may cause damage to your windows.

1.  Expand HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

2.  Click on each of the profiles starting with S-1-5-21 and delete all that are affected (hint:  Look at the ProfileImagePath, if it says the user)

How to delete SQL Maintenance Plan text reports

Posted on Updated on

By default, SQL keeps track of all SQL Maintenance plan operations. And it creates reports about them every time they run in the \MSSQL.1\MSSQL\LOG folder. And overtime, these reports take up a lot of space.

Here are some things you can do to manage these files:

1. First, you can try to move the files to a different drive

– Login to SSMS, and open one of your maintenance plans

– Open ‘Reporting and Logging’ by clicking on the icon to the right of Manage Connections

– Set the new path for the LOG files

2. Another option is to add a task in your maintenance plan to clean up the reports

– Add History Cleanup Task in your maintenance plan (optional)

– Add Maintenance Cleanup Task and set type as ‘Maintenance Plan Text Reports’ and specify the LOG folder path.

How to enable deduplication in Windows 8

Posted on Updated on

1. Download the package from the link and extract it in ‘C:\windows\system32’ folder

2. Run this command on elevated rights, this will add the package under ‘Programs and Features’ dism /online /add-package /packagepath:Microsoft-Windows-VdsInterop-Package~31bf3856ad364e35~amd64~~6.2.9200.16384.cab /packagepath:Microsoft-Windows-VdsInterop-Package~31bf3856ad364e35~amd64~en-US~6.2.9200.16384.cab /packagepath:Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.2.9200.16384.cab /packagepath:Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~6.2.9200.16384.cab /packagepath:Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.2.9200.16384.cab /packagepath:Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~6.2.9200.16384.cab dism /online /enable-feature /featurename:Dedup-Core /all

3. Next step is to enable Deduplication on a volume, by running an elevated Powershell Enable-DedupVolume <Drive Letter>

4. To return a list of volumes that have been enabled for data deduplication Get-dedupvolume | format-list

5. To start a dedup job Start-DedubJob -Volume <Drive Letter> -Type Optimization

6. You can query the progress of the job on the volume by using the ‘Get-DedupJob’ cmdlet

7. To check the status of deduplication, run the cmdlet ‘Update-DedupStatus <volume name>’

Powershell script to remove white-spaces on a CSV file and convert the time entry to 24-hour format

Posted on Updated on

#Here is a script to remove white-spaces on a CSV file and convert the time entry to 24-hour format.

$fileInput = <location and filename of the input file>

$fileOutput = <location and filename of the output file>

$delimeter = ‘,’

$header1 = ‘#Phone,Original Record,Client ID,Sub-Campaign,Device Attempted,Device Locale,Date Time,Last State,Last State Seconds,Call Seconds,Call Result,Best Contact’

# check if input file exist

if (!(test-path $fileinput)) {

write-host “File not found” exit

}

# check if output file already exist, delete file if true

if (test-path $fileoutput) {

Remove-Item $fileoutput

}

# import and build CSV in memory

#note single word IDs work better, I.E phone otherwise they need to be named with quotes

$header = “Phone”,”Original Record”,”Client ID”,”Sub-Campaign”,”Device Attempted”,”Device Locale”,”Date Time”,”Last State”,”Last State Seconds”,”Call Seconds”,”Call Result”,”Best Contact”

$csv = import-csv -path $fileInput -header $header

$csvTest = @();

# Display function for military time

# Input String

# Output String

function DisplayMilitaryDateTime( $InputDateString ){

[System.DateTime]$convertedDate = [System.DateTime]::Parse( $InputDateString );

#5/16/2014 13:00:02

return $convertedDate.ToString(“MM/dd/yyyy HH:mm:ss”);

}

Add-Content -Path $fileOutput -Value $header1

# all the clean and conversion of data would be here

foreach($line in $csv){

$outLine = “”;

# cleanup data and convert it

$outLine += $line.Phone.Trim(” “) + $delimeter ;

$outLine += $line.”Original Record”.Trim(” “)+ $delimeter;

$outLine += $line.”Client ID”.Trim(” “)+ $delimeter;

$outLine += $line.”Sub-Campaign”.Trim(” “)+ $delimeter;

$outLine += $line.”Device Attempted”.Trim(” “)+ $delimeter;

$outLine += $line.”Device Locale”.Trim(” “)+ $delimeter;

#note the function call

$outLine += DisplayMilitaryDateTime( $line.”Date Time”.Trim(” “) ) + $delimeter;

#this is added so another ‘,’ is added

$outLine += $delimeter; $outLine += $line.”Last State”.Trim(” “) + $delimeter;

$outLine += $line.”Last State Seconds”.Trim(” “) + $delimeter;

$outLine += $line.”Call Seconds”.Trim(” “) + $delimeter;

$outLine += $line.”Call Result”.Trim(” “) + $delimeter;

$outLine += $line.”Best Contact”.Trim(” “);

 

# manually build the output line and append it to the file

Add-Content -Path $fileOutput -Value $outLine }

 

#finally export it

# $csv | Export-Csv -Path $fileOutput -Delimiter ‘,’ -Encoding UTF8 -NoTypeInformation

 

#delete input file after successful conversion

Remove-Item $fileinput

How to test a SQL Connection String using notepad

Posted on Updated on

1. Open Notepad and create an empty file and save it with a .UDL extension. Example. Connect.UDL

2. Go to your desktop and double-click on the file you just created and the Data Link Properties box will popup.

3. Select the Provider tab and Find the provider that you want to connect with and click Next.

4. Now from the Connection tab, select or enter your source/ server name -> then enter information to log on to server -> and select the database on the server.

5. Click Test Connection and click OK to save the file.

 

NOTE:  If you get an error with the connection testing, please make sure that the SQL Server Browser is running.  You can check this by opening SQL Server Configuration Manager on the SQL server and go to the Services menu.