Just a quick script drop we have around 20 content deployment jobs that require disabling and enabling when we are service packing / upgrading. This number is increasing constantly and will eventually be quite large. Here is a one liner to disable and re-enable your content deployment jobs, I have two ps1 files on the server (Turn Off Content Deployment Jobs and Turn On Content Deployment Jobs):
Enable
Get-SPContentDeploymentJob
| ForEach-Object {$_.IsEnabled = $true; $_.Update()}
Disable
Get-SPContentDeploymentJob
| ForEach-Object {$_.IsEnabled = $false; $_.Update()}
Showing posts with label SharePoint Automation. Show all posts
Showing posts with label SharePoint Automation. Show all posts
Wednesday, 11 April 2012
Monday, 26 March 2012
Automated SSL Certificate Import (Certutil)
Just a quick script drop. You can use this script to import SSL certificates. It will import all the the PFX files in the directory to your COMPUTER\Personal\ Store. Which is the required store for your SSL Certificates. It does not import intermediate or CA certificates. I might add that functionality one day. Any questions post a comment below:
set CURDIR=%CD%
for /f "usebackq delims=|" %%f in (`dir /b "%CURDIR%" ^| findstr /i pfx`) do certutil.exe -f -p <PFX File Password> -importpfx "%CURDIR%\%%f"
pause
- Create a Directory called "SSL" (or something like that)
- Drop all your PFX files into the SSL folder
- Create a Batch File "InstallCert.bat"
- Run a command prompt as administrator
- Change Directory to your batch file and run it
set CURDIR=%CD%
for /f "usebackq delims=|" %%f in (`dir /b "%CURDIR%" ^| findstr /i pfx`) do certutil.exe -f -p <PFX File Password> -importpfx "%CURDIR%\%%f"
pause
Thursday, 15 March 2012
SharePoint 2010 Automated Patcher (Alpha Release)
Here is an alpha version of the source code. There is still a lot of work to do one this one but it is a starting point. I used AutoSPInstaller as the foundation for the launching http://autospinstaller.codeplex.com/.
USAGE:
USAGE:
- Download SharePoint Foundation SP1 / SharePoint Server SP1 / Office Web Apps SP1 and put them in the SP directory
- Download the latest cumulative update and put it in the CU directory
- Copy files to all SharePoint Servers
- Open Command Prompt as an administrator
- Run Launcher.bat on each SharePoint Server
- Run Products and Configuration Wizard on each server
- Done
This is the end to end procedure that we follow here:
SharePoint Service Pack / Cumulative Update Procedure
The following procedure outlines the SharePoint
patching process. This is appropriate for both Service Packs and
Cumulative Updates. This does not include Windows Service Packs or
Hot Fixes.
The procedure has been developed for a farm that has two Web Front End
Servers and one Application Server. This procedure can be scaled
up to suit a larger farm.
This procedure is to be used for the following SharePoint and Related
Services Patches:
-
SharePoint Foundation
-
SharePoint Server
-
Office Web Applications
SharePoint Patches will be packaged and installed via the command
line.
Upgrading a SharePoint Farm is a two phase process which consists of:
Phase
|
Description
|
Update Phase
|
During the update phase the farm can continue to be in production
with no downtime. The update process consists of installing the
binaries for the next version of SharePoint on each SharePoint
server
|
Upgrade Phase
|
During the upgrade phase the SharePoint farm must be taken off line
as concurrent connections during an upgrade can cause locks thus causing upgrade
failures. During the Upgrade Phase the SharePoint Configuration
database and Content databases are upgraded to the latest version.
|
Before proceeding with this procedure verify that the
following conditions are true:
-
All the Web Front End Servers are load balanced and are in the rotation of the TMG Load Balancer
-
All the farm servers are operating correctly
-
All the databases are active and operating correctly
-
SQL Database backups are present from the previous evening
Do not proceed with the upgrade if any of the
preceding conditions are not true. Resolve all issues before you
continue.
Update Phase
The following illustration shows the sequence of steps
that are required to install the update on the farm.
1. Copy installation package to
all SharePoint Servers (this will be done ahead of time)
2. Drain Stop PNWB1 from rotation in the TMG Load Balancer
a. Check to validate that all users have been relocated to PNWB2 by checking the Web Service Current Connections performance monitor variable
b. Shutdown PNWB1
c. Snapshot PNWB1
d. Start PNWB1
3. Run Command Prompt as an administrator, Browse to SharePoint Patcher Location and Run Launcher.bat on PNWB1
a. Monitor the Upgrade Status until it completes successfully
b. Verify Upgrade
c. Test to verify the server is operational
4. Bring PNWB1 back into rotation in the TMG Load Balancer
5. Drain stop PNWB2 from rotation in the TMG Load Balancer
a. Check to validate that all users have been relocated to PNWB2 by checking the Web Service Current Connections performance monitor variable
b. Shutdown PNWB2
b. Snapshot PNWB2
c. Start PNWB2
6. Run Command Prompt as an administrator, Browse to SharePoint Patcher Location and Run Launcher.bat on PNWB1PNWB2
a. Monitor the Upgrade Status until it completes successfully
b. Verify Upgrade
c. Test to verify the server is operational
7. Bring PNWB2 back into rotation in the TMG Load Balancer
a. Snapshot PNAP1
8. Run upgrade.bat on PNAP1
a. Monitor the Upgrade Status until it completes successfully
b. Verify Upgrade
c. Test to verify the server is operational
9. At this point all SharePoint Servers have been upgraded to the latest binaries
2. Drain Stop PNWB1 from rotation in the TMG Load Balancer
a. Check to validate that all users have been relocated to PNWB2 by checking the Web Service Current Connections performance monitor variable
b. Shutdown PNWB1
c. Snapshot PNWB1
d. Start PNWB1
3. Run Command Prompt as an administrator, Browse to SharePoint Patcher Location and Run Launcher.bat on PNWB1
a. Monitor the Upgrade Status until it completes successfully
b. Verify Upgrade
c. Test to verify the server is operational
4. Bring PNWB1 back into rotation in the TMG Load Balancer
5. Drain stop PNWB2 from rotation in the TMG Load Balancer
a. Check to validate that all users have been relocated to PNWB2 by checking the Web Service Current Connections performance monitor variable
b. Shutdown PNWB2
b. Snapshot PNWB2
c. Start PNWB2
6. Run Command Prompt as an administrator, Browse to SharePoint Patcher Location and Run Launcher.bat on PNWB1PNWB2
a. Monitor the Upgrade Status until it completes successfully
b. Verify Upgrade
c. Test to verify the server is operational
7. Bring PNWB2 back into rotation in the TMG Load Balancer
a. Snapshot PNAP1
8. Run upgrade.bat on PNAP1
a. Monitor the Upgrade Status until it completes successfully
b. Verify Upgrade
c. Test to verify the server is operational
9. At this point all SharePoint Servers have been upgraded to the latest binaries
Upgrade Phase
The following illustration shows the sequence of steps that are required to finish the patching process by upgrading the farm servers. During this process, the sites that are being upgraded will not be available to users.
1. Remove
both PNWB1 and PNWB2 from rotation in the TMG Load Balancer
2. Run
SharePoint Products Configuration Wizard on the Central Administration Server
PNAP1
3. Run
SharePoint Products Configuration Wizard on PNWB1
4. Run
SharePoint Products Configuration Wizard on PNWB2
5. Bring
PNWB2 and PNWB2 back into rotation in the TMG Load Balancer
Upon completion of User Acceptance Testing remove the Snapshots created in
the Update Phase
Sunday, 11 March 2012
SharePoint 2010 Automated Patcher
SharePoint Patching is a pain especially when you have 29 production servers and 60 non production servers like we do. I have written an automated patcher to cut the operational overhead of SharePoint patching. I am running the first test as I write this and it is looking really positive. I should be able to get a couple up here by Wednesday I would say.
How it works, you put your Cumulative Update in the CU directory and run install.bat. This is what it does.
How it works, you put your Cumulative Update in the CU directory and run install.bat. This is what it does.
- Checks to make sure you are past SP1 if you are not it installs SharePoint Foundation / Server SP1
- Checks to see if Office Web Apps are installed it will install SP1 for Office Web Apps if you have it installed
- Checks to see what CU's you have put in the directory and installs them one after the other
What it does not do:
- PSCONFIG Upgrade that will be a separate script
- Only supports the two latest CU's, if people would like previous CU's post a comment below and I will write the code
- Drain Stop the node from the TMG cluster (I am going to add this in next release)
- Check to see if you are a Farm admin (I am going to add this in next release)
Post a comment if you want additional functionality
<UPDATE> Got a bit held up with this due to other priorities. Doing the first release into production this afternoon if that is successful. I will hopefully have something up here tomorrow</UPDATE>
<UPDATE> Got a bit held up with this due to other priorities. Doing the first release into production this afternoon if that is successful. I will hopefully have something up here tomorrow</UPDATE>
Thursday, 9 February 2012
Update-SPSolution Automated Install
Just a quick script
drop, I am going to polish this up a bit over the coming weeks. This
script will Update all of the WSP’s in the install folder. It will not add new
solutions only update old ones. How it
works:
- Create the following folder structure (where OutofBand is the name of your release):
- Drop your wsps you want to release in the install folder
- Drop your current production wsps in the rollback folder (if you do not have them check this out)
- Create setup.ps1 in the OutofBand folder with the following code
- Do not run this from PowerShell ISE, the Get-Location will fail. This will cause an IISReset
- To deploy your solution files simply run setup.ps1 from SharePoint 2010 Management Shell
- If you need to roll back update the $Rollback variable to $true
#Release Script for SharePoint 2010 wsps
(assumes wsps have already been released)
asnp Microsoft.SharePoint.PowerShell
–erroraction SilentlyContinue
[string]$strDeploymentFiles = Get-Location
-PSProvider FileSystem;
[bool]$Rollback = $false;
if ($Rollback)
{$strDeploymentFiles +=
"\rollback\";}
else
{$strDeploymentFiles +=
"\install\";}
$strd = dir -Recurse $strDeploymentFiles *.wsp;
foreach($wsp in $strd)
{
[string]$strWSPName = $wsp
Update-SPSolution -Identity $strWSPName -LiteralPath
"$strDeploymentFiles$wsp" -Force -GAC
}
Subscribe to:
Posts (Atom)