Wednesday 27 February 2008

SharePoint stsadm.exe and Powershell

Trying to run the SharePoint tool stsadm.exe in PowerSehll I get the following error:

The term 'stsadm.exe' is not recognized as a cmdlet, function, operable program, or script file


To get stsadm.exe to work in PowerShell you have to edit the 'profile.ps1' file.
Look in C:\WINDOWS\system32\windowspowershell\v1.0\ and if it doesn't exist just create a new file and add the following code:

Set-Alias -Name stsadm -Value $env:CommonProgramFiles”\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE”

Now you can use stsadm in Powershell without it buggering up.

No comments: