Powershell: Add or Remove access rights to shared mailboxes in Exchange 2010.

I had a user that was unable to open existing shared mailboxes in Office 2013.The user had upgraded Office from 2010 and was unable to expand the shared mailboxes afterwards.To solve this we had to reassign permissions to the mailboxes. I used the following command to get a list of mailboxes that the user had access to instead of checking each of them manually. $Users = "username" Get-MailboxPermission -Identity * -ResultSize Unlimited | Where-Object {$_.User -like $User} | select identity,user | Export-Csv c:users.csv I edited the CSV to be imported properly by Import-Csv.When the CSV is ready I used the…

0 Comments
Exchange 2010 Mailbox Export to PST using PowerShell

I recently had a need to export mailboxes to PST. This was done in an environment with Exchange 2010.This can easily be done with the following command in the Exchange Management Shell. New-MailboxExportRequest -Mailbox -FilePath \serverPSTIdentity.pst This is a bit inconvenient if you need to export more than a few mailboxes.I created the script below to accommodate my need and to be able to run it from another workstation.The only requirement is that you have access to the Exchange server and that you have the management tools installed for your version of Exchange. As soon as I can get around…

0 Comments
Office 365 Set resource calendar permissions

Hi, As more and more of users move to the cloud the requirements for administrators change.Simply starting Powershell is no longer enough as the systems we want to configure and monitor are further away from us.Fortunately for us the step to connect to Office 365 is quite easy, as long as you know what to do.I have a script to connect using the cmdlets in step 1. The default settings for resource calendars in Office 365 is to show you busy/free information and nothing else. This can't be changed from the web-gui, but we can easily do it from Powershell.…

0 Comments
Changing Virtual Network in Microsoft Azure

There is no simple way to change the virtual network assigned to a virtual machine i Microsoft Azure.The assignments of locations for virtual machines brings a problem when you need to move a machine to a new network. The simplest way to do this from the Azure portal is to create a new machine using the following method. 1. Login to your Azure portal and go to the menu for Virtual Machines.2. Select the machine you want to move and click "Delete". It is very important that you select "Keep the attached disks. If you don't select keep the disks…

0 Comments
Join two variables together with powershell

Hi, Here I will explain two ways I've found to concatenate two variables to a path.I have at multiple occasions had the need to use two variables to form a single path based on input from the command line. This is an example on how to change location using two variables. This doesn't work. $Drive = "D:" $Directory = "Directory" Set-Location $Drive$Directory The reason this doesn't work is that Set-Location accepts $Drive as the entire path and considers $Directory to be a new command. There are two ways to solve this. The first was is to create a third variable…

0 Comments
Disable “Open File – Security Warning” Message

I was building a powershell script that is supposed to update a software from a network share. The software is installed on a Windows 7 x64-bit machine and requires that a lot of updates are installed quickly and simply.The script itself works fine but for every .msp executed you get the message "Open File - Security Warning" prompting you to press Open.After researching a bit I learned that this is caused by the Internet Options treating the serverpath as an internet location. After changing the setting to "Enable (not secure)" I was able to run the script and install all…

0 Comments
Create folder and file for a new project using powershell

My objective is to create a folder with a desktop.ini that is used by my colleagues to store files for a project. Usually I create this manually on the correct file server and copy an existing desktop.ini which I edit and then set the attribute to System. I like to work with scripts and functions so I created the function below. function New-ProjectFolder { [CmdletBinding()] param( [Parameter(Mandatory=$True)] [string[] ]$ProjectNr, [Parameter()] [string[] ]$Description ) BEGIN{} PROCESS{ Write-Verbose "Creating PSDrive PRoot" New-PSDrive -Name PRoot -PSProvider FileSystem -Root \servernameshare | Out-Null Write-Verbose "Creating Project folder $ProjectNr" New-Item -Path PRoot:$ProjectNr -ItemType directory -Force | Out-Null Write-Verbose…

0 Comments
First post for NianIT.com

Finally, it is time for the first post. Hi everyone, My name is Niclas and I work as an IT-technician.I work with everything from desktops to servers and I often encounter problems or inefficient solutions that I have to find a better way to solve.My main subject of interest right now is Powershell and using the seemingly endless possibilities to make things automatic and streamlined. I am still a beginner with using PS but I starting to be able to use it on a daily basis and I learn new things very often. This is my new special place where…

0 Comments