Wednesday, July 03, 2013

Getting data from all mailboxes on exchange 2007

For the second time in 6 months a freedom of information request has been made within the organization I work, this means that yet again I am required to pull a copy of all emails containing the name of the person who made the request.

My setup:
Windows Server 2008 R2 with Exchange 2007 install (all roles on one server).

Where to start:

1) From any email client create a new folder in your email account where you can copy all the emails too (I have used a mailbox called FOIR with a folder called FOI).

2) log onto the server as an administrator and start up "Exchange Powershell".

3) Make sure administrator has good access to all mailboxes:
get-mailboxdatabase | add-adpermission -user administrator -accessrights generic,read, genericWrite
4) Run the search:
get-mailbox | export-mailbox -content keywords "Joe Bloggs" -Targetmailbox FOIR -Targetfolder 'FOI'
Now to extend this a bit:
-content keywords seems to search for each given word seperatly so "boat car plane" will find any email containg boat or car or plane.

Setting in from the first day of this year,
get-mailbox | export-mailbox -content keywords "Joe Bloggs" -Targetmailbox FOIR -Targetfolder 'FOI' -StartDate 01/01/2013
Setting it to exclude certain folders,
get-mailbox | export-mailbox -content keywords "Joe Bloggs" -Targetmailbox FOIR -Targetfolder 'FOI' -excludefolders "\Drafts", "\Junk E-Mail", "\Outbox", "\Journal", "\Calendar", "\Contacts", "\Notes", "\Tasks"

5) Moving all emails found to one folder:
  • Create a folder to move them to (I used FOI_final).
  • In outlook hold ctrl + shift and tap 'f'.
  • Click 'Browse...'.
  • Select the folder you created in step 1 and tick the 'Search subfolders' checkbox, Click 'Ok'.
  • Click 'Find Now'.
  • Click the first message found then hold ctrl and press 'a'.
  • Right click and select 'move' -> 'other folder'
  • Select the newly created final folder then click 'OK'

6) Now the emails are in one folder it is possible to easily export them to a pst file to be handed to who ever needs it.

Tuesday, May 22, 2012

php mail function sendmail

Yesterday I needed to send an email from a php page to an email address, sounded simple enough but when I tried it it did not work, so after a bit of searching I found lots of people having the same issues but no simple instructions to get it working.

Here are the simple instructions.

My Setup:
Ubuntu Server default install with lamp.
Exchange server installed on a different server.

The steps taken:
1) Install sendmail
    from the terminal
    sudo apt-get install sendmail

2) Edit php.ini
    from the terminal
    sudo vim /etc/php5/apache2/php.ini
    approx line 1059 change
    ;sendmail_path =
    to
    sendmail_path = /usr/sbin/sendmail -t -i
    write changes and exit

3) restart apache2
    from the terminal
    sudo /etc/init.d/apache2 restart

4) edit hosts file
    from the terminal
    sudo vim /etc/hosts
    near the top add
    127.0.0.1 hostname.local hostname
    where hostname = your hostname

5) Create your php test page
     from termianl
     sudo vim /var/www/mail.php
     add code

Write changes and exit

6) From a machine with a web browser access the mail.php.

ALL DONE



   

Monday, February 27, 2012

Playing Diablo 2 on Windows 7

Just a quick one today.

Tried playing an old favorite Diablo 2 on Windows 7 today and found it has issues, mainly screwing up the colours on the game.

The fix is simple, all it involves is making sure explorer is stopped while the game is being played.

1) Create a batch file in the diablo 2 folder
2) Edit the batch file to match the following:
taskkill /f /im explorer.exe
game.exe
explorer.exe
3) Save and exit.
4) Change any shortcuts to point to this file instead of game.exe

Enjoy the classic game.

Thursday, January 26, 2012

VB6 Authenticate user against AD

Now I know VB6 is old, but it still works and is easy to quickly write an app, well I thought so until this morning when I needed a simple app that can verify a username and password on my domain. In PHP it is a simple ldap query and the user is verified, trying the same thing in VB6, no chance, it works fine if you are logged on to a domain machine, or there is a way if you are logged on locally to a domain machine, but if your machine is not part of the domain it is a pain in the rear.

After trying for an hour, reading many pages on the web, I finally gave up and went to do something simple (clear the filter in a projector.) Then an idea hit me which works and is very simple.

It goes as follows:
1) find the address of any share on the domain which all users have read access to.
2) In VB6 map the share using supplied credentials.
3) If successful, Congrats the user is verified! unmap the share.
4) If not successful deal with the error.

Finished.

Code as follows:

Dim objnetwork As Object
Set objnetwork = CreateObject("WScript.Network")
On Error Resume Next
objnetwork.MapNetworkDrive "H:", "\\server\share", "false", username.text, password.text
objnetwork.RemoveNetworkDrive "H:"
If Err <> 0 Then
msgbox = "Invalid Username or Password"
Else
'code here for successful logon
End If


End of Code

That is it, no extra declarations no modules, no ldap naming convention, just simple code easy to use with 2 text boxes and a command button.

Monday, December 05, 2011

Roland PC 300 on Windows 7

Recently a friend got his hands on a Roland PC 300 midi keyboard, when trying to install it he found no support for windows vista or 7. All support forums seem to suggest it does not work, this is not true.

1) Download the windows XP drivers here.

2) Run the downloaded file, when it prompts for install directory type in c:\tmp you may receive an error saying this program did not install correctly, if so just click cancel.

3) Plug in and turn on the keyboard. Windows should fail to install the drivers please wait for this to happen.

4) Go to your start menu, and right click on Computer then select manage, then click on Device Manager. Right click on the Unknown Device and click Update Driver Software.

5) Select Browse my computer for driver software.

6) Click Let me pick from a list of device drivers on my computer.

7) Make sure Show All Devices is selected and click Next.

8) Click Have Disk....

9) Click Browse, then navigate to c:\tmp\PC300_WinXPDrv201 select RDIF1008.inf and click open then OK.

10) Wait! this took a couple of minutes on my friends machine, but with any luck that's it.

Now go off and right some great music because all this x factor crap in the charts sucks.

Friday, November 04, 2011

Adobe CS3 Web Standard deployment

Recently I was required to re image our main IT suit, needless to say the images I had were no good so had to build a new one. Image built deployed to 34 machines to discover afterwards that I forgot to put Adobe Web Standard CS3 on the image. Instead of installing it on each machine individually or rebuilding the entire suit again I thought I would just deploy it.

Aim:
Simple, deploy Adobe CS3 with no user interaction.

This seemed so simple to start with, hundreds of guides out there and out of all of them not one worked, got close but always reached the point where I would click on any application and it would request the CD Key.

Final solution:

Decided the best option was to deploy it using our fog server.

Step 1:
Running a virtual machine took a snapshot before the install.

Step 2:
Copied the entire contents of the install DVD into a shared folder.

Step 3:
From the command prompt run setup.exe --record=1, this will allow you to select the applications you want in your install, once it is complete it will output two xml files.

Step 4:
Copy the two created files into the same directory as the setup.exe, (in my case z:\packages\CS3AdobeWS\Adobe CS3\). Rename the files to install.xml and uninstall.xml.

Step 5:
Create the override file (I dont think this is actually doing any thing in my case). Open your favourite txt editer and copy and paste the following:

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<Payload>
<Data Key="Serial" protected="0">1234567890123455678901234</Data>
<Data Key="Registration">Suppress</Data>
<Data Key="EULA">Suppress</Data>
<Data Key="Updates">Suppress</Data>
</Payload>
</Configuration>

Change the Serial to your serial number, then save the file into your main payload folder as application.xml.override make sure there is no extention after override.(my main payload folder is z:\packages\CS3AdobeWS\Adobe CS3\payloads\AdobeWebSuiteStandarden_US_Volume\.)

Step 6:
Test the silent install. From thecommand line navigate to the folder containing setup.exe then run setup.exe --mode=silent --deploymentFile="install.xml" (this is case sensative).

Step 7:
Assuming the setup complets with an error 0 everything has gone ok.
In my case this worked but when running any of the apps it prompts for the serial number, to get over this I entered my serial number, skipped the registration and set it to never registe, then the application opened. Close the application then navigate to the folder c:\program files\common files\adobe\adobe pcd\cache then copy the cache.db file into the same directory as setup.exe.

Step 8:
Back in the folder containing setup.exe create a batch file called install.bat and copy and paste the following into it:

setup.exe --mode=silent --deploymentFile="install.xml"
copy cache.db "c:\Program Files\Common Files\Adobe\Adobe PCD\cache\"

Step 9:
This is where I love snapshots, restore your virtual machine back to it was prior to the install (or uninstall the software), then run the install.bat. If al goes well after setup is complete you should be able to run the app with out needing to re enter the serial number (there will be no confirmations of setup finishing you just have to wait or check task manager).

Step 10:
Prepare to deploy via fog or any app that can deploy and run exe files.
I used a free application called SFXMaker available from http://www.isoft-online.com/, once installed run the application and select the Directory tab. In the Directory Path select the directory containg setup.exe. In the File to Run box select the install.bat. In the SFX Path select where you would like to save the new installer. Click Create and wait.

Finish:
Now I have a single exe file i can add as a snappin in fog, then assign to machine or machine group, then under advanced deployment click deploy snappins.

This works for me, hope it might help someone else one day, but as stated before this is mainly the aid my memory.

Wednesday, June 08, 2011

Disable Windows 7 Ease of access via GPO

Tried to find this online but seemed dificult so thought i would paste my way here.
1) Open Group Policy Manager
2) Creat a new Gpo on the Windows 7 machines OU
3) Edit the GPO, Computer Configuration -- Policies -- Windows Settings -- Security Settings.
4) Right click on 'File System' select 'Add File'.
5) Browse to 'c:\windows\system32\Utilman.exe' Click 'OK'
6) In the security tab select 'Administrators' and click 'deny' under full control, the do the same for users.
7) Click OK
8) Your done!