Category: PowerShell

Installing SQL Server Denali CTP3 on Server Core

One of the new features in SQL Server Denali CTP3 is support for installation on Server Core. There’s an MSDN article on “Installing SQL Server Denali on Server Core” and another MSDN article on "Install SQL Server Denali from the Command Prompt" that has a detailed list of all the different parameters. Based on the first article, the setup routine should enable and/or install all of the necessary prerequisites, but that simply isn’t the case from what I found. If you just run setup Read more [...]

Check the Time on Remote Machines with PowerShell

I ran into an issue lately where the domain controller that hosts the PDC emulator FSMO role for the forest root domain became unavailable and the time for several machines in the domain was far enough off to start causing kerberos related security problems. Here's a simply Powershell script to query the time on remote machines via WMI. You could use Invoke-Command with Get-Date, but that takes too long compared to just using WMI. I chose to hard code the names I wanted to query directly into Read more [...]

Terminal Server Related PowerShell Scripts

Thought I would post a couple of PowerShell scripts that I’ve recently written. Both of these scripts were written specifically for terminal servers but they can be modified as needed. The first one finds what terminal servers a user is logged into. It retrieves a list of terminal server names from the specified OU. I started out by using the Get-TSServers cmdlet for the list of servers, but that cmdlet takes a while and you have more control by just using the Get-ADComputer cmdlet since your Read more [...]

Find AD User Account Lockout Events with PowerShell

A few weeks ago a user contacted me and stated they were constantly being locked out throughout the day. This could have been caused by a number of things from someone else trying to log in as them to being logged in somewhere else, changing their password and the session with the old password still being active. I ran a search of the security event log on the domain controllers and found the name of the machine that the user was being locked out from. The event ID for lockout events is 4740 for Read more [...]

Create AD Group and Copy a Group’s Members with PowerShell

This week, I was asked if I could export a list of users who were members of a specific group in Active Directory. My Question: What's this list for? Answer: We're working on a project that requires us to create a new security group in Active Directory and we're going to add all the users on the list to the new group. I determined that this new group really was necessary. My response: I can do even better than providing you guys with a list. I can create the new AD group, output a list of users, Read more [...]

Resolving SharePoint 2010 PDF Issues with PowerShell

PDF’s that have been uploaded to your SharePoint 2010 document libraries do not show the correct icon and only give you the option of saving instead of opening them: The following PowerShell script downloads a 17x17 GIF image from Adobe.com named pdficon_small.gif, places it in the images folder under the 14 hive, associates it in the DOCICON.XML file, sets Browser File Handling to Permissive, and then runs IISReset:   The first part of the script downloads Read more [...]

Dell EqualLogic PS4000 – Creating a Volume with PowerShell

Download the EqualLogic Host Integration Toolkit (HIT Kit) for Microsoft from the EqualLogic support site. Install the PowerShell Tools portion of the HIT Kit on the computer you want to manage the SAN from. For a PS4000, this computer doesn't need access to the iSCSI network as long as it has connectivity to the management network. The following PowerShell script creates a 36GB thin provisioned volume named mikefrobbins with a snapshot reserve of 100%, sets a description for the volume, allows Read more [...]

Set SharePoint 2010 Outgoing E-Mail Settings with PowerShell

Configure the outgoing email settings in a SharePoint 2010 Farm with PowerShell. Launch the PowerShell ISE. Import the SharePoint PowerShell Snap-in, modify the script below using your specific email server settings and then run the script. The outgoing email settings are now configured. µ Read more [...]

Microsoft SharePoint Foundation 2010 Installation – Part 3

This blog is a continuation from last weeks blog (Part 2). We’ll jump right in where we left off. Verify you are logged into the server that you want to install SharePoint on as the spNameInstall account. Right click the PowerShell ISE and select "Run as administrator": Load the SharePoint PowerShell Snap-in: You will receive "The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered." This is normal since we have not configured Read more [...]

Microsoft SharePoint Foundation 2010 Installation – Part 1

You're ready to introduce SharePoint 2010 into your SMB and you've chosen to install the "free with Windows Server" version called "Foundation". Details about this version can be found on the SharePoint Foundation 2010 Production Information webpage. You'll need a minimum of two servers, virtual or physical with the specifications listed below to get started. While it is possible to run SharePoint 2010 on a single server, it's definitely not recommended for a production environment. Depending on Read more [...]

Create an Active Directory User Account with PowerShell

I’m in the process of installing SQL Denali and need a couple of users accounts created. If you are creating the Active Directory user on a machine other than a domain controller, you’ll need to install the Active Directory module for Windows PowerShell. Then import the Active Directory module. To see the syntax and available options for creating an Active Directory user using PowerShell, type "Get-Help New-ADUser" inside the PowerShell console. Store Read more [...]

Install the PowerShell ISE & Enable PowerShell Scripts

PowerShell 2.0 is installed by default on Windows 7 and Windows Server 2008 R2. The PowerShell ISE (Integrated Scripting Environment) is installed by default on Windows 7, but not Windows Server 2008 R2. You can use the following information to install the ISE on your 2008 R2 server (as long as it’s running the full GUI and not the Core installation). Launch PowerShell and execute the following: If you attempted to run this on the Core (no GUI) installation Read more [...]

PowerShell Script to Return a List of Mailbox Size for All Users

On several occasions, I've been asked to provide a report of mailbox sizes and number of items in a mailbox to a few of my customers who are running either Exchange Server 2007 or 2010. Like most of my blogs, this blog is as much documentation for myself as anything else. That way when I need to provide another one of these reports again in a few months, I'm not trying to figure out how I previously accomplished the task. The following PowerShell Script creates a text file that contains a list Read more [...]

Creating a Shared Mailbox in Exchange 2007

Open Exchange Management Shell and execute the New-Mailbox cmdlet using the following example as a template: The following cmdlet assigns full access for the mailbox to a group in Active Directory named “My Shared Mailbox Admins” which needs to exist in AD prior to executing this command: This cmdlet allows members of the “My Shared Mailbox Admins” group in Active Directory to be able to send email from the "mysharedmailbox@mikefrobbins.demo" Read more [...]