In previous post , created web application using Server Object Model.
Now , try to create new web application using PowerShell Management.
This method using in-line command.
New-SPWebApplication
-Name "UKREDDYSITE" -Port 8888 -URL "http://ukreddy" -ApplicationPool
"SharePoint8888" -ApplicationPoolAccount (Get-SPManagedAccount
"UKREDDYSYKAM\Administrator") -DatabaseName "WSS_Content_8888"
-DatabaseServer "UKREDDY" -AllowAnonymousAccess: $false
-AuthenticationMethod "NTLM" -SecureSocketsLayer:$false
Method 2:
This method using Script file.
Copy the following code snippet and paste it in notepad then save it as "<filename>.PS1"
Then execute the PS1 file in powershell.
$sp_webapp_name = read-host -prompt ‘Web application name:’
$sp_webapp_port = read-host -prompt ‘Web application port:’
$sp_webapp_Url=read-host-prompt 'Web application URL'
$sp_webapp_url = $sp_webapp_Url
$sp_webapp_apppool = read-host -prompt ‘Web application pool name:’
$sp_webapp_apppoolaccount = read-host -prompt ‘Web application pool account:’
$sp_webapp_databasename = read-host -prompt ‘Web application pool database name:’
$sp_webapp_databaseserver = read-host -prompt ‘Web application database server name:’
#Create a new Web Application
New-SPWebApplication -name $sp_webapp_name -Port $sp_webapp_port -URL $sp_webapp_url -ApplicationPool $sp_webapp_apppool -ApplicationPoolAccount $sp_webapp_apppoolaccount -DatabaseName $sp_webapp_databasename -DatabaseServer $sp_webapp_databaseserver
Now , try to create new web application using PowerShell Management.
Method 1:
This method using in-line command.
Method 2:
This method using Script file.
Copy the following code snippet and paste it in notepad then save it as "<filename>.PS1"
Then execute the PS1 file in powershell.
$sp_webapp_name = read-host -prompt ‘Web application name:’
$sp_webapp_port = read-host -prompt ‘Web application port:’
$sp_webapp_Url=read-host-prompt 'Web application URL'
$sp_webapp_url = $sp_webapp_Url
$sp_webapp_apppool = read-host -prompt ‘Web application pool name:’
$sp_webapp_apppoolaccount = read-host -prompt ‘Web application pool account:’
$sp_webapp_databasename = read-host -prompt ‘Web application pool database name:’
$sp_webapp_databaseserver = read-host -prompt ‘Web application database server name:’
#Create a new Web Application
New-SPWebApplication -name $sp_webapp_name -Port $sp_webapp_port -URL $sp_webapp_url -ApplicationPool $sp_webapp_apppool -ApplicationPoolAccount $sp_webapp_apppoolaccount -DatabaseName $sp_webapp_databasename -DatabaseServer $sp_webapp_databaseserver
Comments