26 November 2012

How to get Windows Server uptime

The quickest way to determine, how long the server you are working with, has been up and running is:

wmic os get lastbootuptime

It returns the result in ISO date format:

image

The +120 means time zone information (UTC +2 hours).

20 November 2012

How to remove unwanted e-mail addresses from Mail Contacts in Exchange 2010

Default e-mail address policy creates for every recipient object an address with @your.domain at the end. This is true even for Mail Contacts. So when you need an external contact (for adding to a distribution group for example), you unintentionally gave an address of your domain also. For that you need to create a new policy, to prevent such things.

The policy will be with the following parameters (the Container should also be selected, it’s not yet done on this screenshot):

image

The filtering part can be skipped with Next button. You cannot skip e-mail addresses page, so just create a new address, that is with an address, that is not present in internet (usually your local domain name will be sufficient @domain.local for example):

image

Click Next, Next and New. Now you should be done. If you create a new contact, only this address will be added. For existing contacts you need to remove previously created @your.domain addresses. For that you will need few commands in Exchange Management Shell:

$contacts = Get-MailContact -ResultSize unlimited
$contacts | foreach {$contact = $_; $email = $contact.emailaddresses; $email | foreach {if ($_.smtpaddress -like "*@your.domain") {$address = $_.smtpaddress ; Set-Mailcontact -Identity $contact.identity –forceupgrade -EmailAddresses @{Remove=$address}}}}

The script gets all MailContact objects into $contacts variable. For each member of the variable (each contact) email addresses will be extracted and verified to match for specific condition (matching your domain name). If it matched, then it will be removed from the corresponding MailContact object. ForceUpgrade is needed, if some of the objects are created in previous Exchange version.

17 November 2012

How to change case quickly in Word 2013 (and older versions)

Recently I made a typo in Word by pressing CTRL+SHIFT+K instead of SHIFT+K (uppercase letter K) and suddenly the word, I was in middle off, changed like that:

image

So it made lowercase letters to small capitals.

Which reminds me of an older discovery to change case with SHIFT+F3 key combination:

image

This rotates between small case, UPPERCASE and Title Case. First of all you need to be in the middle of a word

image

or select several words.

image

10 November 2012

How to save YouTube video to a file in played quality

To do this, you need 2 free tools:

  1. Google Chrome (www.google.com/chrome)
  2. VLC Player (www.videolan.org/vlc)

Start watching your video in chrome. To test, you can use this URL http://youtu.be/9bZkp7q19f0. Remember to choose the needed resolution:

image

Wait for the buffering to end. You don’t need to watch the video to the end. It’s the light grey bar that indicates the buffering:

image

Open the folder:

%localappdata%\Google\Chrome\User Data\Default\Pepper Data\Shockwave Flash

image

And copy the .TMP file to your desktop. Rename it to something more meaningful and change the extension to .FLV

image

You can open this video now with VLC Player.

As a side note, you can export the video to other audio/video formats using VLC (including MP3)

image

Enjoy your favorite videos even offline.

07 November 2012

How to monitor Exchange 2010 database health

If you have fault tolerant RAID1 disk system, you can have a failure of one HDD. But when this happens, you are vulnerable. So you need a solution for monitoring this kind of events.

In Exchange 2010 you can have mirrored databases, where you expect the same kind of fault tolerance. If you don’t have a huge monitoring software, you can use a simple PowerShell script:

$date = Get-Date
"Adding Exchange snapin"
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
$mailboxservers = Get-ExchangeServer | ? {$_.serverrole -like "*mailbox*"}
$info = $mailboxservers | foreach {Get-MailboxDatabaseCopyStatus -Server $_.name}

$filename2 = "c:\serverinfo\Exchange Databases {0}.{1:d2}.{2:d2} {3:d2}.{4:d2}.csv" -f $date.year,$date.month,$date.day,$date.hour,$date.minute
$info | Export-Csv -Path $filename2 -encoding utf8
$info2 = $info | where {($_.Status -ne "Healthy" -and $_.Status -ne "Mounted") -or $_.ContentIndexState -ne "Healthy"}
$info3 = $info2 | ConvertTo-Html
$info4 = [string]$info3

if($info2){
Send-MailMessage -SmtpServer yoursmtpservername -To
to@addre.ss -From from@addre.ss -Subject "Exchange databases having bad times" -Body $info4 -BodyAsHtml
}

This script in short:

It finds all mailbox servers, on each of them gets the status of mailbox database copies and if anything is wrong with database or index status, then it sends a message. As a bonus it saves the full info to a CSV file for troubleshooting.

This script should be run with task scheduler every hour or so.

02 November 2012

Change retention range for all protections groups in DPM 2012

Let’s assume, you have installed your DPM server, created a bunch of protection groups and everything runs smoothly. By default a protection group holds backups for 5 days. To get the information about your protections groups, use this command:

Get-ProtectionGroup -DPMServerName yourdpmservername | ft FriendlyName,OnsiteRecoveryRange -a

The result looks like this:

image

First you need to open protection group for writing:

Get-ProtectionGroup -DPMServerName yourdpmservername | Get-ModifiableProtectionGroup

To change the retention range to 10 days, use this command:

Get-ProtectionGroup -DPMServerName yourdpmservername | Set-PolicyObjective -RetentionRangeDays 10 -BeforeRecoveryPoint

This command doesn’t give any output and runs very fast.

To write changes, use this command:

Get-ProtectionGroup -DPMServerName yourdpmservername | Set-ProtectionGroup

After change you can confirm the result with the first command introduced in this article.

30 October 2012

How to assign a user the permission to create new contacts in Exchange 2010

Let’s say you’re tired to create new external contacts and want to assign this right to another user. Or the user is tired to wait for an administrator to make a mail contact. Typical use of external contacts is inside mail distribution groups, because you cannot simply add an e-mail address to the group.

First of all you need to find the right role which contains the right command. In this case the needed command is New-MailContact. You can search the right role with the following command in Exchange Management Shell:

Get-ManagementRole | Get-ManagementRoleEntry | where {$_.name -eq "new-mailcontact"}

The result will look like this:

image

So the role which contains the right to add new contacts is “Mail Recipient Creation”. This role contains a lot of other commands. To see, what commands are available for this role:

Get-ManagementRole "Mail Recipient Creation" | Get-ManagementRoleEntry

You will get a lot of commands:

image

For this task you don’t need all those entries. You need only New-MailContact and Get-MailContact. But in fact you need also Get-Recipient, because without this your end user cannot see the Organization Administration part in the Outlook Web App. So you need to create a new role, which is a little bit more restrictive. To accomplish this, use this command:

New-ManagementRole -Name "Contact Editor Role" -Parent "Mail Recipient Creation"

This will make a clone or sub role to the existing recipient creation role. To remove unnecessary commands from the new role, use this command:

Get-ManagementRole "Contact Editor Role" | Get-ManagementRoleEntry | where {$_.name -ne "get-recipient"} | Remove-ManagementRoleEntry
Add-ManagementRoleEntry "Contact Editor Role\Get-MailContact"
Add-ManagementRoleEntry "Contact Editor Role\New-MailContact"

First line removes all possible commands except get-recipient. After that I add two extra commands: Get-MailContact and New-MailContact.

Now, when Role is created with correct tasks available (Role Entry), you need to create a role group. This is best done using OWA or ECP logged on as Exchange Administrator. ECP can be accessed in OWA using the Options menu:

image

Choose “Manage” and from there “My Organization”:

image

Choose Roles & Auditing and click New… button:

image

Fill in Role Group name, add previously created “Contact Editor Role” and choose members (user, who can add new contacts):

image

Optionally you can choose Organization Unit, but it’s useless, because in ECP the user can create MailContacts only to /Users folder. It’s not even an OU.

Now log on to OWA with the end user account. Go to Options, choose to manage “My Organization” and voila! The “New” button is available in Contacts section.

image

As you notice, you cannot delete or modify contacts. For that, you can add more role entries. For changes to get in effect, you need to close end-user browser and reopen it to see new buttons to appear.

18 October 2012

How to get computer vendor, product type and serial number programmatically

This article will be one of the shortest. Use this command:

wmic csproduct get vendor & wmic csproduct get name & wmic bios get serialnumber

image

How to change Windows file server name properly

Lets go through few scenarios, where you can use the procedure described in this article:

  1. Change physical hardware of the file server. The new server will get new name because you probably don’t want a huge service outage. At some last stage you copy all files from old server to new one and shut down old server. So how old shortcuts will work, if the name is not accessible.
  2. Move data from several file servers to one. You keep share names and consolidate data, but old server names should be accessible.
  3. You migrate to (or from) DFS (Distributed File System).
  4. Maybe DFS or file server name seems a little awkward and you want to change it.
  5. Maybe some other cases, you name it

Ok, you have one of those stories. What’s next.

First of all you need to create a CNAME record on your DNS server. If your old file server name was OLDFS and new one is NEWFS (you need to use \\OLDFS to access the same stuff available on \\NEWFS), then you need this kind of record:

oldfs in cname newfs (it depends on DNS implementation, how it will be exactly). On Microsoft DNS you will create a record similar to the following picture:

image

If the name OLDFS is referring to a DFS, then you need to point to DFS namespace (for example FQDN of your windows domain).

So, the name resolution problem is solved – the desired server name refers to right server(s).

Next one you need to do is to have SPN (Service Principal Name) in place. For that you need a single command executed on your DC (maybe it will work on other computers as well).

setspn -a cifs/oldfs newfs

This command instructs newfs to accept oldfs as the server name for file server protocol. Or maybe it instructs the client computer. But anyway, this step is necessary (at least in some cases). The result of this command will remain in Active Directory.

If the OLDFS name will refer to DFS namespace, you need to run this command several times:

setspn -a cifs/oldfs DC1
setspn -a cifs/oldfs DC2

setspn -a cifs/oldfs DCN

If your infrastructure has a lot of domain controllers, you probably want to automate this. I suggest to use PowerShell commands:

import-module ActiveDirectory
Get-ADDomainController -filter * | foreach {setspn -a cifs/oldfs $_.name}
Get-ADDomainController -filter * | foreach {$_.name; setspn -L $_.name | findstr cifs}

First line imports AD module (did you remembered to run this command on DC?). Next one lists all domain controllers and for each of them runs the setspn command to add Service Principal Name. Last line lists SPN-s with cifs in the name, so you can check whether the name addition/update was successful.

And at last you need on your file server a little registry change on your file server:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters]
"DisableStrictNameChecking"=dword:00000001

image

In case of DFS, the change needs to be done on all domain controllers. For that you can use Group Policy on Domain Controllers OU. The registry change can be done in Group Policy Preferences section as seen on following screen shots:

image

image

And now you are ready to access \\oldfs, which will redirect you to new file server or to your DFS.

09 October 2012

Change Exchange 2010 incoming/outgoing message size limit

Default incoming/outgoing message size limit in an Exchange environment is typically 10MB. If you need to send or receive larger attachments, you will run into problems. As today for example gmail.com allows 25MB attachments, you probably want to allow those e-mails to reach your users.

The limit is present in Exchange configuration in several places:

  1. Organizational limit
  2. Receive Connector limits
  3. Send Connector limits

There are a lot of more places to look at, if those don’t work. In this case look first http://technet.microsoft.com/en-us/library/bb124345.aspx for more information.

To get current configuration quickly, you can use following commands on Exchange Management Shell:

Get-TransportConfig | ft MaxReceiveSize,MaxSendSize -a
Get-ReceiveConnector | ft Name,MaxMessageSize -a
Get-SendConnector | ft Name,MaxMessageSize -a

To change the sizes to one particular number (25MB for example):

$m=25MB
Get-TransportConfig | Set-TransportConfig –MaxReceiveSize $m
Get-TransportConfig | Set-TransportConfig –MaxSendSize $m
Get-ReceiveConnector | Set-ReceiveConnector –MaxMessageSize $m
Get-SendConnector | Set-SendConnector -MaxMessageSize $m

image

Afterwards you should check the results with the first 3 commands:

image

And you should be able to send and receive e-mails with larger attachments now. Of course, if you have 3rd party systems on the path of your e-mail, you must change those also.

04 October 2012

Backup of Hyper-V virtual machine unsuccessful using DPM 2010 or DPM 2012

You can have a problem backing up a virtual machine using DPM 2010 or DPM 2012. In my case, the backup ended with error:

An unexpected error occurred while the job was running. (ID 104 Details: The parameter is incorrect (0x80070057))

After investigating the issue using VSSADMIN I realized that everything in VSS is ok. Creation of manual snapshots in guest and host computer were successful.

The commands to try manual snapshot are:

  • vssadmin create shadow /for=C:
  • vssadmin list shadows
  • vssadmin delete shadows /for=C:

image

So finally I found out that in the virtual machine configuration the path for VHD file contained double-backslash.

image

After removing the extra backslash, everything worked like a charm.

03 October 2012

Migrating server and agents from DPM 2010 to DPM 2012

Before DPM Server installation, make sure, that your Time Zone is correct. To change Time Zone after DPM installation, follow the instructions (http://technet.microsoft.com/en-us/library/hh758055.aspx):

  1. Change Time Zone on Windows Server
  2. net stop msdpm
  3. DPM Console – Options, Auto Discovery. Change the schedule (this triggers the recalculation of time zones on all jobs)

For server migration, install a new server with Windows Server 2008 R2 and DPM Server 2012 (currently I’m having problem with Windows Server 2012, restore operation is unavailable).

For client migration (use the following steps in this sequence):

  1. Stop dpm agent on client machine (net stop dpmra)
  2. Uninstall dpm agent from client machine using appwiz.cpl (Add/Remove Programs) or by command line (usable on Core Editions):
    Windows 2008
    MsiExec.exe /X{5EB850FE-84F7-4856-A203-0F80BC93C66A}
    Windows 2003
    MsiExec.exe /X{3EC7C770-9F3F-4177-A754-EBFF04A1AFF2}
  3. Remove Protection Group from old DPM Server (you probably will retain the data, since new data is not yet available)
  4. Disable firewall on client machine
  5. Uninstall agent from old DPM Server and remember those things:
    1. don’t install the new agent before this step
    2. the uninstall will throw error message because we already removed it, this is ok, if the agent disappears from Agents list on DPM Server
    3. please remove client manually and stop the service before the manual uninstall, this way you can avoid the restart of client machine
  6. Install the agent from new DPM Server
  7. Enable the firewall on client machine (if it was disabled in step 4)
  8. Create new Protection Groups and enjoy the game

28 September 2012

Scheduled reboot for Windows Server

If you need to restart a Windows Server, you have a lot of options:

  1. Use PowerShell cmdlet Restart-Computer.
  2. Use Sysinternals tool psshutdown.exe (downloadable from http://live.sysinternals.com/psshutdown.exe, sometimes it’s available also with UNC \\live.sysinternals.com\tools\psshutdown.exe, you need to start webclient service using net start webclient in administrative command prompt)
  3. Use the shutdown.exe already in Windows installation.
  4. Or just use graphical interface :)

For instant reboot you can use all of them (for example PowerShell’s Restart-Computer with no parameters reboots local computer instantly).

To schedule a reboot, I suggest psshutdown.exe (shutdown.exe is a strip down version of psshutdown.exe, with less parameters). To shut down the server @22:22 (22 minutes past 10pm) use this command:

psshutdown -f -r -t 22:22

image

The 13:38:00 in the picture doesn’t mean the reboot time, which is 22:22:00. It mean’s that after 13 hours and 38 minutes the server will reboot.

If you need to abort the countdown, use psshutdown –a

image

20 September 2012

How to make yourself MSSQL admin

There is a good chance, that you run into a Microsoft SQL Server, where you don’t have administrative access. This can be happen when SQL is installed using another user account and this account is deleted afterwards.

First of all you need to stop SQL service (it can stop other SQL services also):

image

Then look at the properties of the service. Copy and paste the path to executable to administrative command prompt:

imageimage

Add to the command line "-mSQLCMD" and press Enter. This will run SQL server in interactive and single user mode and allows only sqlcmd to be launched.

image

At a different administrative command prompt run sqlcmd. If it fails with “Only one administrator…” error, then block SQL port using Windows Firewall and try again starting the service manually in single user mode. If it fails with “Token-based server access validation failed with an infrastructure error”, then you are not in administrative command prompt

image

When you succeed running sqlcmd, type two commands:

sp_addsrvrolemember 'domain\user', 'sysadmin'
go

image

Now your account domain\user is an administrator of this SQL server.

To close open command prompt windows gracefully, type quit and press Enter in sqlcmd prompt and press CTRL+C on sql server prompt and press Y.

Also remember to start services.

18 September 2012

Check Calendar folder permissions and reset folder name in Exchange 2010 room mailboxes

If you have several room mailboxes and want to audit Calendar folder permissions, then the PowerShell command you need is:

Get-Mailbox -RecipientTypeDetails roommailbox | %{" ";"$_";"----------";Get-MailboxFolderPermission $_":\Calendar"}|ft -a

If this command doesn’t work, use those two instead:

$rooms = Get-Mailbox -RecipientTypeDetails roommailbox
$rooms | %{" ";"$_";"----------";Get-MailboxFolderPermission $_":\Calendar"}|ft -a

The command will get all room mailboxes and show permissions on each of them like shown on the following picture:

image

As you notice, some of the room mailboxes will throw error messages. That’s because Calendar folder is named differently (for example Kalender when using Estonian or Kalenteri when using Finnish).

To see room mailboxes regional settings, use the command

Get-Mailbox -RecipientTypeDetails roommailbox | Get-MailboxRegionalConfiguration | ft -a

It will show you the information, which isn’t very valuable, because language and folder names can still be different. The output looks like this:

image

As you can see, we have even New Zealand region :) To reset all room mailboxes to common calendar folder name, use this command:

Get-Mailbox -RecipientTypeDetails roommailbox | Set-MailboxRegionalConfiguration -Language "EN-US" -LocalizeDefaultFolderName -DateFormat yyyy-MM-dd

After the change the regional information is changed:

image

And the audit is successful

image

And finally to change for example the Default permission to Author, you can use this command:

Get-Mailbox -RecipientTypeDetails roommailbox | %{Set-MailboxFolderPermission $_":\Calendar" -User Default -AccessRights Author}

30 August 2012

Change Exchange 2010 Receive Connector certificate

If you have IMAP clients, then you want to make sure that the connection is encrypted. By default IMAP uses TCP port 143 and SMTP for sending uses TCP port 25. For encrypted traffic the usual port assignments are TCP port 993 for IMAPS and 587 for SMTPS.

To make the access to Exchange via IMAP clients easier you probably use a nice common name like mail.company.com. For that name you have a 3rd party certificate (or a certificate from a local CA). This certificate must be installed on a local store on every Client Access Server. This can be done via IIS configuration window:

image

Just select the server name from the left and double-click Server Certificates icon. From there you can request or import a certificate:

image

If you have Active Directory Certificate Services, you can use Create Domain Certificate.

For enabling this certificate for different services you need to use Enable-Exchangecertificate cmdlet. To see available certificates for Exchange to use, use Get-Exchangecertificate cmdlet.

Enable-ExchangeCertificate uniqueid -Services pop
Enable-ExchangeCertificate uniqueid -Services smtp
Enable-ExchangeCertificate uniqueid -Services imap
Enable-ExchangeCertificate uniqueid -Services http

Uniqueid is the thumbprint that can be seen in Get-Exchangecertificate output.

For POP and IMAP to get working with new certificate, you must restart corresponding services. For SMTP to get working, you must change the FQDN on affecting receive connector:

image

The FQDN must be the same as the common name on the certificate.

23 August 2012

Getting to know which Hyper-V guest is using disk using PowerShell script

Best way to investigate disk usage on hyper-v host is to look at all guests and figure out, which one is exhausting the system. The only way to get those readings is using perfmon (Performance Monitor) Hyper-V specific counters. Simple Task Manager or Resource Monitor doesn’t give that detail.

I got even further and scripted this. First take a look at the script:

$date = Get-Date
"importing AD module"
import-module activedirectory
"Getting computer list from AD"
$servers = Get-ADComputer -LDAPFilter "(operatingsystem=*server*)" | sort name
$servers |  measure
$i=1
write-host "Getting Hyper-V Disk Activity information..."
$info = $servers | foreach {
    $computername = $_.name
    write-host ($i++) $computername
 
    $readcounter = "\\" + $computername + "\Hyper-V Virtual Storage Device(*)\Read Bytes/sec"
    (get-counter -Counter $readcounter).countersamples | foreach {
        $obj = new-object psobject
        $obj | add-member noteproperty Host ($computername)
        $obj | add-member noteproperty Access ("Read")
        $obj | add-member noteproperty VHD ($_.InstanceName)
        $obj | add-member noteproperty MBps ([Math]::Round($_.CookedValue/1024/1024,2))
        $obj
        }
    
    $writecounter = "\\" + $computername + "\Hyper-V Virtual Storage Device(*)\Write Bytes/sec"
    (get-counter -Counter $writecounter).countersamples | foreach {
        $obj = new-object psobject
        $obj | add-member noteproperty Host ($computername)
        $obj | add-member noteproperty Access ("Write")
        $obj | add-member noteproperty VHD ($_.InstanceName)
        $obj | add-member noteproperty MBps ([Math]::Round($_.CookedValue/1024/1024,2))
        $obj
        }
        
    }
    
$filename2 = "c:\serverinfo\HVdiskactivity {0}.{1:d2}.{2:d2} {3:d2}.{4:d2}.csv" -f $date.year,$date.month,$date.day,$date.hour,$date.minute
# $info | Export-Csv -Path $filename2 -encoding utf8
$info2 = $info | where {$_.MBps -ge 1} | sort MBps -Descending
$info3 = $info2 | ConvertTo-Html
$info4 = [string]$info3
 
if($info2){
Send-MailMessage -SmtpServer smtp.domain.com -To rauno.magi@domain.com -From rauno.magi@domain.com -Subject "Hyper-v guests having greatest VHD activity" -Body $info4 -BodyAsHtml
}

What does this script do? Let’s look at step by step:



  1. First it import’s Active Directory module and uses it to get the list of all servers, which will be recorded to variable $servers

  2. Then it uses this list of servers to query performance information on each of them using get-counter cmdlet. It would be nice to reduce the list to hyper-v server’s only, but this is cosmetical and performance issue and doesn’t affect the functionality

  3. Nice thing is creating a new empty object and populate all properties/rows with data got from new-object cmdlet.

  4. All the information gathered will be stored into $info variable, which can be optionally saved to a csv file. This command is commented out at the moment

  5. Filtered and sorted list (disk activity more than 1MB per second, biggest numbers on top) will be sent as a e-mail message attachment in the message body.

06 August 2012

Getting rid of “reboot from a previous installation” message

Sometimes you might be unable to install some software with the following message:

A reboot from a previous installation is pending. Please restart the system and rerun setup.

This example is from Exchange Management Tools installation.

image

First you should try reboot (sometimes twice) and if this doesn’t work, look at the registry hive

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager

image

The key PendingFileRenameOperations should be normally not present. If it’s there, remove it. Then you can run your setup again and this time successfully.

12 July 2012

Reclaim free space on Windows Server 2008 R2 SP1

Free space on C: drive will eventually go below your threshold. After investigating the cause with TreeSize Free tool (http://www.jam-software.com/treesize_free/), I ended up in this result (biggest folder is with the name winsxs):

image

If you are running out of other options to free space on a Windows Server 2008 R2 SP1 computer, then as a last resort you can disable SP1 uninstall feature by running the following command on the administrative command prompt:

dism /online /cleanup-image /spsuperseded

image

It will remove the files needed for Service Pack uninstall and free some gigabytes on Windows drive. In my case about 4GB.

11 July 2012

NetStumbler’s replacement for Windows 7

If you are using Windows 7 and you want to see details of wireless networks in your range you can use command line (NetStumbler doesn’t work on Vista nor 7):

netsh wlan show networks mode=bssid

or in short

netsh wl sh n b

The result is something like that (fragment of an output)

image

If you want a graphical utility, take a look at inSSIDer (http://www.metageek.net/products/inssider-wifi-scanner)

05 July 2012

Outlook/Exchange and Notes/Domino and Rich Text

If you send an e-mail with Rich Text formatting from Exchange to Domino, it appears very ugly in Lotus Notes.

Original message in Outlook:

image

As seen on Lotus Notes:

image

As you can see, the result looks ugly. It doesn’t look always ugly, it depends on several factors: Outlook contact properties, Active Directory Contact/Mail User properties and Remote Domain settings. I suggest to change only remote domains settings on Exchange 2010.

Easiest way is to do it on Exchange Shell (get all remote domains and disable Microsoft proprietary TNEF/Rich text format for sending e-mails):

Get-RemoteDomain | Set-RemoteDomain -TNEFEnabled $false

Graphical interface is also possible. Select your remote domain from Organization/Hub Transport/Remote Domains and change the following setting:

image

And yes, all your e-mails can have attachments and formatting after changing this setting. Your e-mail can have 3 formats, when you use Outlook:

  1. Plain Text
  2. Rich Text
  3. HTML

All messages containing formatting information will be converted to HTML format instead of the second option (Rich Text).