For various SharePoint admin tasks, there are times when you need to execute an STSADM command from within a PowerShell script.
Before you can do that, you’ll need to tell PowerShell where to find STSADM executable. You can do that by adding the following line to your profile.ps1 file (usually located in C:\WINDOWS\system32\windowspowershell\v1.0 ):
Set-Alias -Name stsadm -Value $env:CommonProgramFiles”\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE”
Now you can use stsadm in your scripts and it should work beautifully…