Browsed by
Category: Powershell

How To Configure DHCP Using Powershell

How To Configure DHCP Using Powershell

I have complied some notes on how to install and configure DHCP using Powershell cmdlets.  These can come in handy for setting up lab environments quickly or scripting changes within your environment easily. The first cmdlet is how to install the necessary role: Once the DHCP role has been created you can start to configure scopes and various options needed for that scope. The cmdlet below creates a scope with the range 10.10.54.3-254, it sets the subnet to 255.255.255.0. And…

Read More Read More

Enable Telnet with Powershell

Enable Telnet with Powershell

Every now and again you need to troubleshoot firewall rules and Telnet is a great tool to help understand if a port is open or not between two devices.  However Telnet is not enabled by default anymore, it has been like that since Windows Server 2008. The following Powershell commands will help you to quickly enable it: Installing the Telnet client doesn’t require a reboot.   The client can also be removed easily via Powershell with these commands:

Configure non-integrated DNS zones with Powershell

Configure non-integrated DNS zones with Powershell

I’ve been looking at scripting out the build out of my Azure Lab so I can build it, use it for a purpose then rip it down and start again to use it again.  One of the scripts that I’ve pulled together is configuring non-integrated DNS Zones with Powershell both on a local server and a remote server. The script I’ve created assumes that the DNS role is installed on your servers and that PSRemoting is enabled on your servers. …

Read More Read More

How to Run PowerShell Commands on Remote Computers

How to Run PowerShell Commands on Remote Computers

Powershell Remoting can allow you to run individual commands or run full Powershell sessions on remote systems.  Unfortunately by default it is locked down, so before you try to use it you need to enable it.  Within a domain this is an easy process. On the computer you wish to remote to open up a Powershell command as Administrator. Run the following cmdlet:   This command will start the WinRM service and sets it to automatic, it also creates a…

Read More Read More

Connecting to Azure with PowerShell and controlling your VMs

Connecting to Azure with PowerShell and controlling your VMs

I have a small lab setup within Azure and over the past week I have been working quite a bit within that lab perfecting a couple of PowerShell scripts.  As I have limited credits available to me within Azure I am always careful to ensure that my Virtual Machines (VMs) are only running when I need them and de-allocated when I am not using them.  Having to sign in to the Azure Portal to start the VMs and then do…

Read More Read More

Office 365 URL Generator

Office 365 URL Generator

I have recently been working on a project that has seen me pull together a PAC file that helps to separate Office 365 Express Route traffic, Office 365 CDN traffic, internal traffic and general Internet traffic to different proxy servers. It’s been a complicated process and one of the issues was gathering the necessary URLs that are currently associated with Office 365.  Using the script that Aaron Guilmette (https://gallery.technet.microsoft.com/Office-365-Proxy-Pac-60fb28f7) wrote I was able to pull out the URLs that Microsoft…

Read More Read More

Pull Name, SMTP, OU and last logon time from Exchange 2013

Pull Name, SMTP, OU and last logon time from Exchange 2013

This script enables you to pull together the Name, Primary SMTP Address, Organizational Unit and Last Logon Time information.  This information can be useful if you are trying to find out which mailboxes are being used or not.  This script has been tested on Exchange 2013 only. Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName, PrimarySMTPAddress, OrganizationalUnit, @{label=”LastLogonTime”;expression={(Get-MailboxStatistics $_).LastLogonTime}}

Retention Policy Powershell Commands

Retention Policy Powershell Commands

I’ve recently been working on applying retention policies to mailboxes and we’ve been doing a granular roll-out to the users.  I’ve been using some Powershell commands to track who has the policy applied and who hasn’t. The following command will list all users who have a retention policy applied to their mailbox: Get-Mailbox -filter ‘RetentionPolicy -like “*”‘ | Select-Object Name, RetentionPolicy You can export that to a CSV if need be by using:  Get-Mailbox -filter ‘RetentionPolicy -like “*”‘ | Select-Object…

Read More Read More

Clearing out move requests

Clearing out move requests

When you perform a successful mailbox migration, either from another version of Exchange or from another mailbox database the move request is “left” behind as such and should be cleared out as part of good housekeeping. My favourite command for doing this is: Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

This website stores some user agent data. This data is used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to opt-out of any future tracking, a cookie will be set up in your browser to remember this choice for one year. I Agree, Deny
558