HowTo export Exchange 2010 mailbox to a PST file format

There are several occasions in which an administrator would want to export Exchange 2010 mailbox to PST. The most common ones include to migrate on-premise mailboxes to Exchange online and to extract a single or a few mailboxes from the database. Though rare, another situation that demands such an export is to salvage data from a damaged or corrupted Exchange 2010 database file (EDB).

You’d have to agree that all those are pretty good reasons to support the conversion of EDB data to PST format. Now that that’s established, how about moving on to the technique to do it? Well, that’s the interesting part; we’re letting you know a neat method to use PowerShell commands and achieve the said export. But if you’re in the mood for some automation, we also have a suggestion up our sleeve that’ll surely impress you. So hang on tight and let the fun begin!

Mailbox Export Request

To export a mailbox or archive data to a PST file, first, a mailbox export request needs to be created. Each request has a unique name and for each mailbox up to 10 unique requests can be created. But, at one time, only one request can be executed since the PST file is marked as in-use when the request begins to run. Additionally, the Exchange Management Console (EMC) that is used for running cmdlets for different Exchange tasks cannot be used to create a mailbox export request. For this purpose, the Exchange Management Shell (EMS) must be used.

Microsoft Exchange Server 2010 has introduced a new set of PowerShell cmdlets to achieve this task. Another thing to note here is that though PowerShell scripts are quite powerful and helpful in exporting and importing data, they’re not supported over 64-bit machines. If EDB files are corrupted, dismounted or disconnected, an EDB to PST conversion independent of Exchange server can bulk export Exchange 2010 mailbox to PST (32-bit as well as 64-bit).

Ok but, how the hell do we do it? Let’s check the steps:

Steps to export mailbox to PST

The process to export mailbox to PST Exchange 2010 is divided into 4 broad steps.

1) Grant necessary permissions and roles

As the first step, create grant full rights to user who will be performing the export. By default no accounts have this right hence they need to be manually configured. Execute the following command in EMS:

New-ManagementRoleAssignment –Role "Mailbox Import Export" –User Administrator

In the command above, “User” is the username. If you’re already logged in with that username, just restart the EMS session and you’ll be granted access to the new cmdlets.

2) Create a Network Share that will store the exported PST files

There can be multiple CAS in a network and any of them can process the export mailbox request. Thus, you must ensure that the path of the target PST file is valid. This path has to be UNC not a local path. The ideal method is to create a new Network Shared folder and grant the grant Exchange Trusted Subsystem group read/write permission to this folder.

3) Export mailbox to PST

Now that everything is configured properly, the PowerShell cmdlets can be executed to perform Exchange 2010 export mailbox to PST.

To export user’s primary mailbox to PST:

New-MailboxExportRequest -Mailbox <username> -FilePath <pstFilePath>

In the above command, points to the folder that will store the exported PST file. This command doesn’t create a new directory so make sure the path you’re giving exists, otherwise the command will fail.

To export user’s personal archive to PST:

New-MailboxExportRequest -Mailbox <username> -IsArchive -FilePath <pstFilePath>

To export specific data from user’s mailbox to PST:

New-MailboxExportRequest -Mailbox <username> -ContentFilter {<filter>} -FilePath <pstFilePath>

In the above command, {} can be any value that filters required data from the rest. Please check Microsoft support for the correct syntax.

To export a specific mailbox folder to PST:

Specific mailbox folders include mailbox folders such as Inbox, SentItems, DeletedItems, Calendar, Contacts, Drafts, Journal, Tasks etc. In the command, the folder to be exported is denoted within opening and closing # markers. For example, to export Inbox folder, denote it as #Inbox# in the following command:

New-MailboxExportRequest -Mailbox <username> -IncludeFolders "#Inbox#" -FilePath <pstFilePath>

4) Monitoring & Cleaning up

As a last step, the export process must be cleaned up after. To check the status of all active export jobs, run the following command:

Get-MailboxExportRequest | Get-MailboxExportRequestStatistics

Once all mailbox export requests are completed, to clean up, remove all assigned permissions using the following command:

Remove-ManagementRoleAssignment "Mailbox Import Export-<username>"

Also remove the completed mailbox export request from the server with the following command:

Get-MailboxExportRequest | where {$_.status -eq "Completed"} | Remove-MailboxExportRequest

Thank you to the guys over at stellar, without your handy info the above HowTo would not be possible.

Questions/Comments?

HowTo Scanners on Linux(Raspberry Pi) – Project SANE

It turns out, even old scanners has a function in the modern era, thanks to our brothers and sisters at the SANE project.

For printers, you have CUPS and for scanners you have SANE

They pretty much saves the day if you don’t want to have a dedicated Windows PC just for scanning or printing every once in a while. As the world shifts to the full digital age, it’s less and less common to perform these tasks.

But as we all know; when you need the old hardware to work, you need it badly. Printers are not famous for being very trustworthy or stable. Because after all, the manufacturers make money on the ink and not on good hardware. It’s a perfect study-case for a tiny Raspberry Pi, as these tasks don’t require much horsepower.

Even though you have one device for both scanner and printer, they are separate things. Nowadays multi-function boxes like this is pretty common, but the software is still pretty different for scanning and printing. Remember; the official Windows drivers and software are separate.

This article is for the scanning part

First and foremost, this is a setup that works both for LAN connection and USB connection as I figured out for this particular scanner, Canon LiDE 700F. You should just try with LAN if you are doing this with a network enabled device, then try USB if it’s doesn’t work.

Server – Raspberry Pi

PLEASE NOTE: This section assumes that you’ve already configured your Raspberry Pi or that you know how to do this.

Install SANE

Most of the Linux distros have SANE in their main repositories. To install, type:


sudo apt install sane-utils -y

Detect the scanner

scanimage -L

Lan Connection Result:

device `genesys:libusb:001:003-wired’ is a Canon XXX flatbed scanner

[Troubleshooting]

If you do not get a similar response (replace “Canon XXX” with the model number that you are working with), check if you can PING your device’s IP. If you do get an ECHO response, try connect to the device via your browser.

Some Canon units have a setting under “Other Settings” and certain settings might need to be enabled there. Please refer to your Canon documentation, or drop a comment with your query.

USB Connection Result:

device `genesys:libusb:001:003′ is a Canon LiDE XXX flatbed scanner

[Troubleshooting]

If you do not get a similar response (replace “Canon XXX” with the model number that you are working with), try using the lsusb command to see if the unit was picked up by the USB ports:

Bus 001 Device 003: ID 04a9:1907 Canon, Inc. CanoScan XXX

If lsusb does not list a scanner, try the sane scanner finder:

sudo sane-find-scanner

A typical result will look like this:

found USB scanner (vendor=0x04a9 [Canon], product=0x1907 [CanoScan], chip=XXX) at libusb:001:003

If a scanner cannot be found nor detected, please check the physical cables to ensure that they are connected.

Test the scanner on the “server”

Providing scanimage -L returned a result, we can test the scanner by typing in terminal:

scanimage > test.ppm

You should be able to view the test with any image viewer. scanimage is easy to use from the terminal and has several options, please see the scanimage -h for all of the control options like resolution, colours etc.

Share the scanner over the LAN

It’s time to share the scanner over the network!

Type in:

sudo nano /etc/sane.d/saned.conf

Find the line that contains the line below and uncomment it:

192.168.1.0/24

The above uncommented line will allow all addresses from the 192.168.1.1-192.168.1.254 range. You could restrict this to a single IP address or multiple IP addresses, depending on who needs access or how your network is set up.

Please note: The default port that is used to serve incoming connections is 6566

To start the socket service (providing you use systemd), type:

sudo systemctl start saned.socket

To start it up when the system starts, type:


sudo systemctl enable saned.socket

Looking for a Graphical Scanner Client?

If you’re looking for a decent GUI client for your scanner, I’d suggest you run with “gscan2pdf“.

To install the client, type in:

sudo apt install gscan2pdf


Questions/Comments?

Raspberry Pi File Manager keeps crashing

Recently I had a case where Raspbian’s default file manager(pcmanfm) kept on crashing.

The user would click on the icon, the application would open and then immediately close or crash. If the application was executed from terminal, the same results were met.

I had a look at the logs and noticed that pcmanfm kept on throwing out a “Segmentation fault

A quick fix for this issue is to reinstall the pcmanfm:

sudo apt-get install --reinstall pcmanfm

Questions/Comments?

HowTo change a user into a SUPERUSER in PostgreSQL

Modifying user permissions within PostgreSQL can range from rather simple to extremely complex, depending on the permissive granularity that is actually required. In most cases, however, it is the powerful ALTER USER command that should be utilized to do everything from allowing users to login, create databases, manage roles, and even become a SUPERUSER account.

In this little HowTo, we will explore the power of the ALTER USER command so you can easily perform a variety of permission assignments and removals as the need arises.

Create a new user

Before we get into altering user permissions, we should establish a new user account (commonly referred to as a ROLE) to mess around with.

To begin, we’ll list all the existing users:

=# SELECT usename FROM pg_user;
 usename
----------
 postgres
(1 row)

By default, postgres is typically the only user that exists, so we want to create a new user of derpaderp to control our derpingdb database. This can be accomplished using the CREATE USER command:

=# CREATE USER derpaderp;
CREATE ROLE
=# SELECT usename FROM pg_user;
  usename
-----------
 postgres
 derpaderp
(2 rows)

Viewing existing user permissions

It can often be useful to examine the existing permissions assigned to the users in the system. This can easily be accomplished with the \du command from the psql prompt:

=# \du
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 derpaderp |                                                | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}

We can clearly see that even though we’ve now added a new derpaderp user, we have to assign it some permissions.

Altering existing user permissions

Now that our derpaderp user exists, we can begin using ALTER USER to modify the permissions granted to derpingdb.

The basic format of ALTER USER includes the name of the user (or ROLE) followed by a series of options to inform PostgreSQL which permissive alterations to make:

=# ALTER USER role_specification WITH OPTION1 OPTION2 OPTION3;

These options range from CREATEDB, CREATEROLE, CREATEUSER, and even SUPERUSER. Additionally, most options also have a negative counterpart, informing the system that you wish to deny the user that particular permission. These option names are the same as their assignment counterpart, but are prefixed with NO (e.g. NOCREATEDB, NOCREATEROLE, NOSUPERUSER).

Assigning SUPERUSER permission

Now that we understand the basics of creating users and using ALTER USER to modify permissions, we can quite simply use the SUPERUSER option to assign our derpaderp user SUPERUSER permission:

=# ALTER USER derpaderp WITH SUPERUSER;
ALTER ROLE

If we display our permission list now, we’ll see derpaderp has the new SUPERUSER permission we want:

=# \du
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 derpaderp | Superuser                                      | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}

Revoking permissions

In the event that we make a mistake and assign a permission we later wish to revoke, simply issue the same ALTER USER command but add the NO prefix in front of the permissive options to be revoked.

For example, we can remove SUPERUSER from our derpaderp user:

=# ALTER USER derpaderp WITH NOSUPERUSER;
ALTER ROLE
=# \du
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 derpaderp |                                                | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}

Questions/Comments?

Keyboard Shortcuts Keys

What is a Keyboard Shortcut?

In computing, a keyboard shortcut is a set of one or more keys that invoke a command in software or an operating system.

They are typically an alternate means for invoking commands that would otherwise be accessible only through a menu, a mouse, or an aspect of the user interface. These shortcuts can expedite common operations by reducing input sequences to a few keystrokes.

These shortcuts can provide an easier and quicker method of using computer programs. These commands are commonly accessed by using the [Alt] key (on PC computers), [command key] (on Apple computers), [Ctrl], and [Shift] in conjunction with a single letter.

These shortcuts are for the following programs and applications.

  • Word
  • Windows
  • Internet Explorer
  • File Explorer
  • Windows System Commands
  • Firefox
  • Excel
  • Mac
  • Finder
  • Chrome

 

(more…)

\