Archive for April, 2007

SharePoint Management Trials on a Virtual Machine Image

This was a big week for us: for the first time ever Quest Software is offering trial versions of its product as virtual machine images.

That means that if you are interested in SharePoint management, reporting, or item-level recovery you can simply download the trial virtual machine image that has both SharePoint and the tools deployed for you and just open the image with Virtual Server, VMWare player, or your other favorite virtualization software.

We believe that this provides a much better evaluation experience: significantly easier than making you deploy a test lab yourself (or try new software in production!) and much more true-to-life than flash demos.

The current images are pretty big but we plan of making them smaller in the future. If this approach proves to be a success (which I am sure it will) in a few years you’ll see all our products having virtual machine sandboxes as the primary method of trial version distribution.

Virtual machine appliances are not that widely spread in the Windows world today but I believe that this is starting to change.

If you want to read about how this project emerged and why it took us so long to get here I would recommend reading this ComputerWorld article: Microsoft offers a peak at software distribution future.

P.S. Just found that Volker from Microsoft’s VHD team blogged about that as well. Volker did a lot to make this happen. Big kudos to him and his team!

Tags: , , , , , , ,

Advertisements

Austin’s DEC PowerShell Dinner Pictures

Austin has just started uploading some of the pictures he took at DEC last week to his Flickr stream. This is a useful source of visual information of who is who in the PowerShell world (unfortunately not comprehensive because not everyone made it to the conference).

Scotty, Deji, me, onion rings, and Richard

Scotty, Dung, me, onion rings, and Richard

Robert and Rene from PowerGadgets

Robert and Rene from PowerGadgets

Rolf, Austin, his wife, and fragments of other guys

Rolf, Austin, his wife, and fragments of other guys

Rene, Alex’s hand, Shawn, and Jackson

Rene, Alex’s hand, Shawn, and Jackson

Here’s the entrire feed (including shots from the conference itself so you know it was not all just dinner.)

Anyway, this was a great show for PowerShell and a really nice dinner (PowerShell bus was incredibly cool!)

Was good to finally meet a lot of the guys face to face!

Tags: , , , , , ,

Enable User Accounts with PowerShell

Question: How to enable AD user account using Windows PowerShell cmdlets?

Answer (shamelessly stolen from Andrei’s post in the PowerGUI discussion forum):

1. [If this is a new account] Create the account using New-QADUser. Make sure the password is also set (-UserPassword parameter)

2. Enable the account by setting userAccountControl to 512: e.g.

Set-QADUser TEST\testuser -ObjectAttributes @{userAccountControl=512}

Bulk account provisioning: 

If you want to do that in bulk using csv file for bulk user account provisioning this might (depending on the columns in your file and attributes being set) look like:

PS C:\> Import-Csv users.csv | ForEach-Object {New-QADUser -ou acme.local/demo -name $_.Name -UserPassword $_.Password

PS C:\> Import-Csv users.csv | ForEach-Object {Set-QADUser $_.Name -ObjectAttributes @{userAccountControl=512}}

Due to AD cmdlets not having a community site of their own we have created a forum for Active Directory PowerShell discussions on PowerGUI.org. Andrei and other members of his team are there for your questions, feature requests, etc.

Tags: , , , ,

AD provider vs. AD cmdlets

Richard has interesting considerations in his blog about AD provider potentially being too dangerous as its use might be error-prone, so someone could type del * without understanding the current context and thus the consequences.

When we started working on our AD cmdlets we surely had a lot of discussions of the approach to take: cmdlets or provider. Frankly, we didn’t think of this danger of inadvertent AD changes that Richard mentions. We picked cmdlets as a way to give administrators more intuitive and functional commands to accomplish their tasks.

You see if you want add an account to a group it is probably more natural for you to type something like: add-groupmember than to use file-system metaphor for this not file-system-related task. Cmdlets also make the functionality more discoverable with tab-completion letting you easily see what parameters are available for that particular command on that particular object.

Does this mean that cmdlets are always a better choice though?

I am not sure really. I still think that being able to use the provider to browse AD, cd into OUs, dir their contents, etc. – is very impressive and in fact highly intuitive.

I guess bottom-line is that it is great that both projects exist and both are available as free downloads.

In his DEC session by the way Richard demoed how you can use those together piping out provider output into AD cmdlets. That was pretty cool. Richard promised to publish his demo transcript in his blog later on – if you could not attend his DEC session make sure you grab the transcript once it gets published.

Tags: , , , , , , ,

PowerGUI 1.0.5 is out!

We have just released version 1.0.5 of PowerGUI. You can get it free from the PowerGUI community web site and no registration is required.

Most new features and fixes are listed on the roadmap page.

Some of them are minor improvements which will hopefully make everyone’s life easier: the Actions pane is open by default, most commands are duplicated on the toolbar, setup has the latest packs for network management, Exchange (with UI for certificate management!) and Operations Manager, etc.

We’ve made a few improvements in the architecture as well. The biggest is asynchronous work with PowerShell so PowerGUI no longer waits for all objects to be retrieved before it starts displaying you what it got.

We have also moved to a new setup which should have less issues than the Visual Studio one we used before (it might require you to uninstall 1.0.4 though – but will preserve all you settings during the upgrade anyway.)

One gotcha that I want to mention is that 1.0.5 checks whether PowerShell Community Extensions are installed and if it detects version 1.1 or earlier would not let you install PowerGUI. We had to do this due to the incompatibility issues the extensions had.

If you do use the extensions there’s a workaround to that check:

1. Comment out the extensions’ lines in the PowerShell profile which cause the issue:

lines 98 and 138 in your profile.ps1:

(line 98)
# Start-TabExpansion

(line 138)
# . '.\TabExpansion.ps1'

the ‘#’ prevents the line from executing when powershell/powergui starts up.

2. Download the PowerGUI 1.0.5 setup from PowerGUI.org and run the file from the command-line using the following command:

msiexec.exe /i PowerGUI.1.0.5.22.msi IGNOREPSCX=1

Thanks to Austin for locating the issue and suggesting the workaround! Austin, please redownload the setup and use the command above!

Tags: , , , , , , , , , ,

PowerShell Script for Mailbox Provisioning

Yesterday I posted a blogcast on PowerShell-based mailbox provisioning.

Below is the script which PowerGUI executes when you click that Create from CSV file action.

What I am doing in the script is basically:

1. Prompt for the file name (param).

2. Read into into an array.

3. Check whether columns with mandatory parameters are in the file.

4. And then just go column by column constructing the new-mailbox command for each row.

5. If Password column is not present I use UPN instead (you can change to your own rule).

6. Finally, I just call Invoke-Expression for all these generated commands.

Of course in PowerGUI all you need to do is just click a button, but for all PowerShell geeks out there here’s the code:

param($file)

[array]$csv = import-csv $file

# This script implies that columns "UserPrincipalName", "name",

# "database","OrganizationalUnit" exist in the csv file

if (($csv[0].UserPrincipalName -eq $null) -or ($csv[0].Name -eq $null) -or ($csv[0].Database -eq $null) -or ($csv[0].OrganizationalUnit -eq $null) ) {throw "Parameter missing... Make sure the CSV file has the following columns: UserPrincipalName, Name, Database, OrganizationalUnit."}

# Create collection of the commands that we will invoke in the end
[collections.arraylist]$Commands=new-object system.collections.arraylist

for($i=0; $i -lt $csv.Count; $i++)
{

[void]$Commands.Add("new-mailbox -UserPrincipalName `"$($csv[$i].UserPrincipalName)`" -Name `"$($csv[$i].Name)`" -Database `"$($csv[$i].Database)`" -OrganizationalUnit `"$($csv[$i].OrganizationalUnit)`"" + ' -Password $pwd ')
}

# Add other parameters if present in the CSV

if ($csv[0].Alias -ne $null) {
for($i=0; $i -lt $csv.Count; $i++)
{
  $Commands[$i] = $Commands[$i] + " -Alias `"$($csv[$i].Alias)`""
}
}

if ($csv[0].DisplayName -ne $null) {
for($i=0; $i -lt $csv.Count; $i++)
{
$Commands[$i] = $Commands[$i] + " -DisplayName `"$($csv[$i].DisplayName)`""
}
}


if ($csv[0].FirstName -ne $null) {
for($i=0; $i -lt $csv.Count; $i++)
{
$Commands[$i] = $Commands[$i] + " -FirstName `"$($csv[$i].FirstName)`""
}
}


if ($csv[0].LastName -ne $null) {
for($i=0; $i -lt $csv.Count; $i++)
{
$Commands[$i] = $Commands[$i] + " -LastName `"$($csv[$i].LastName)`""
}
}


if ($csv[0].Initials -ne $null) {
for($i=0; $i -lt $csv.Count; $i++)
{
$Commands[$i] = $Commands[$i] + " -Initials `"$($csv[$i].Initials)`""
}
}


if ($csv[0].SamAccountName -ne $null) {
for($i=0; $i -lt $csv.Count; $i++)
{
$Commands[$i] = $Commands[$i] + " -SamAccountName `"$($csv[$i].SamAccountName)`""
}
}


for($i=0; $i -lt $csv.Count; $i++)
{
$pwd = new-object Security.SecureString

if ($csv[0].Password -ne $null) {
$csv[$i].Password.ToCharArray() | foreach { $pwd.AppendChar($_) }
} else {
$csv[$i].UserPrincipalName.ToCharArray() | foreach { $pwd.AppendChar($_)
}

}

Invoke-Expression $Commands[$i]

Tags: , , , , ,

Provision Exchange Mailboxes from CSV

Wouldn’t it be great to pick a few mailboxes, export their properties to Excel, make a few changes, and use that changed file to provision a bunch of new user accounts and mailboxes? PowerGUI comes with commands to do that!

PowerGUI gives you user interface for a lot of actions which used to require scripting. While I am striving to find time at DEC to finish editing my webcast, so I thought I’ll do a few blogcasts (is there such a word already?) now instead.

Here we go:

1. Download and install PowerGUI on a computer which has either Exchange 2007 or its management tools.

2. Click Mailboxes, make sure that the following columns are displayed (right-click the header to add the columns): UserPrincipalName, Name, Database, OrganizationalUnit – these are mandatory for new Exchange mailboxes.

3. Select the mailboxes you want to export and click Report as CSV:

Select sample mailboxes for provisioning

4. Specify the filename for the output (e.g. c:\test.csv) and click OK. The file will open in whatever is your CSV edit. Normally it should be Excel- in my case the machine didn’t have Office so I had to use Notepad:

Change propeties

5. Change the properties as you wish for the new mailboxes (in my case I just did Replace All), add new rows, add a column Password and set passwords for the new accounts (otherwise we’ll just use UPN for that).

6. Save the file.

7. In PowerGUI click Create new from CSV action.

Create from CSV

8. Type in the file path and click OK.

Select CSV file

9. That’s it – the new accounts and mailboxes got provisioned!

New mailboxes are there!

If you want to schedule provisioning to happen on regular basis (e.g. nightly) just go to the PowerShell Code tab and use the code there for your script.

PowerShell and PowerGUI rock! 😉

Tags: , , , , , ,


My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

April 2007
M T W T F S S
« Mar   May »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

%d bloggers like this: