Use Set-Mailbox to add email alias based on Get-Mailbox Filter

logo-powershellThe company who I work for are currently in the process of migrating away from Exchange on premise and over to Office 365. Now, 95% of our ActiveDirectory records are set to inherit the mail recipient policy – the other 5% have been excluded for one reason or another.. As the technical lead on the project, I had to come up with a way to add the new/required email address to all mail accounts prior to migration. Which is there this little PowerShell script was born.. I must admit, I have somewhat of a love/hate relationship with PowerShell, I understand its powerful, and that things have to change.. Its just taking me sometime to get used to it.. Anyway, this is what I have so far, it may well be that it could be tweaked somewhat, so if you have any suggestions please do let me know!

Steps involved

  1. Search Exchange for all mailboxes with the inherit flag unticked
  2. Build the new email address using Firstname.Lastname
  3. If the first name and last name fields are blank in AD, build the address using the display name.
  4. Strip any spaces out of the name, and replace with full stops
  5. Finally – add the new mail address to the Exchange Object

Read More

VB: How-to: Launch an App and wait until it’s loaded

If you have a need to launch an application from your VB.Net app, but need to wait till the application has completed loading before you continue processing then check out the snippet below.

I have seen many ways of doing this, mainly based around wait timers or CPU levels.. However, so far I have found this one to be the most reliable..

 

Read More

VB: Pass current user credentials to proxy server

In a corporate environment its not usual to have to pass through a proxy server to get out to the net, this can often be a challenge when building apps/scripts etc. However – to make things slightly less complicated, you can use the VB snippet below to pass the details of the currently logged on user to the proxy.

You can also adjust the code to pass username and password if you wish, however best make it secure!

Read More

Easy Digital Downloads API VB.net Class

Easy Digital Downloads Logo

Easy Digital Downloads Logo

I have just started using the Easy Digital Downloads Software Licensing WordPress Plugin to secure and distribute my .NET applications, as the system was primarily developed for WordPress plugins – I decided I would put together a .NET ‘wrapper’ to make it easier to implement into my projects. You can find the class and usage instructions below.

As always – if you have a suggestion on how to improve this, please leave your comments in the section below

For ease of use, and because I prefer it to the built-in functionality I have used the Json.NET component.

1. Download and add to your project Json.NET

2. Create a new class, insert the following: (Click here for an easy to copy/paste version of the code)

3. Then on your form/where you want to check/activate from:

Notes

If you get any unusual responses, make sure you check the URL in a browser – http:///?edd_action=activate_license&item_name=&license=

To do 

  • Replace the message boxes with the code you wish to process depending on the outcome.
  • It may be worth storing the entered serial number in a user setting, so you can periodically check it’s still valid

Improvements
Given the opportunity I plan on doing the following tasks, until then – the module is working..

  • Replace the first for loop with a direct access of the license value – during testing I was unable to work around an error “Cannot access child value on Newtonsoft.Json.Linq.JValue” until I have resolved this I have chosen to use a select case 
  • Implement the ‘get_version’ functionality of EDD

Read More

How To: Create AD accounts with group membership using VBScript

Last week we had a need for a collection of AD accounts for testing purposes. Which is when I came up with this straight forward VBScript. This script uses a simple integer incrementation to create a collection of active directory accounts with unique usernames, sets their passwords, and then adds them to a security group.

In the example below I am creating 80 accounts, if you require more or less – simply change the number 80 on line 12

Read More