Datasheet
6 CHAPTER 1
•
WINDOWS POWERSHELL 101
psconfig -cmd services -install
if not errorlevel 0 goto errhnd
ECHO %DATE% %TIME%: Installing features
psconfig -cmd installfeatures
if not errorlevel 0 goto errhnd
ECHO %DATE% %TIME%: Creating central admin site
psconfig -cmd adminvs -provision -port i
%CENTRALADMIN_PORT% -windowsauthprovider enablekerberos
if not errorlevel 0 goto errhnd
ECHO %DATE% %TIME%: Adding app content to CA site
psconfig -cmd applicationcontent -install
if not errorlevel 0 goto errhnd
goto end
:errhnd
echo An error occurred - terminating script.
:end
In this case, the script is using
PSConfig
to create a SharePoint 2007 Farm. Notice
that variables can be used and follow the format
%NAME%
. Here’s another example
demonstrating the use of STSADM to deploy a custom SharePoint Solution Package
to the Farm:
stsadm -o addsolution -filename i
“Lapointe.SharePoint.STSADM.Commands.wsp”
stsadm -o deploysolution -local -allowgacdeployment -name i
“Lapointe.SharePoint.STSADM.Commands.wsp”
stsadm -o execadmsvcjobs
Any of the preceding scripts can be run from a standard command prompt by
simply adding the path of the SharePoint Root BIN folder to the
%PATH%
environ-
ment variable:
c:\program files\common files\microsoft shared\web server
extensions\12\bin
c01.indd 6c01.indd 6 5/16/2011 11:12:30 AM5/16/2011 11:12:30 AM