Archive: Posts Tagged ‘PowerShell’

How to delete a service application using Powershell

1 comment August 9th, 2011

The SharePoint 2010 Central Administration is great, but just like every other version of SharePoint, it doesn’t always quite cut it and even though you’re the “Admin” you inevitabley won’t be able to do something you want to do.  Go figure right? We can’t do whatever we want when we want to? Who would have though that? 

Well STSADM used to be to the “one” who wouldn’t say “NO” as much as often or as LOUD as CA while giving you less lame excuses. 

With SP2010, PowerShell is another option we have to turn to that does more of what we want when we want with even less lame excuses.

Let’s run through how to delete a service application when CA is saying NO…

Lets find the service application we want to delete using the following command:

$spapp = Get-SPServiceApplication -Name "Service Application Name"

For the “Service Application Name” (yes, include the quotes in the command) just type the service name you see in your CA under:

Central Administration >> Application Management >> Service Applications >> Manage service applications

or since we are talking about using Powershell, use the following command to display the services:

Get-SPServiceApplication

For Example: Search Service Application

So your command might look like this:

$spapp = Get-SPServiceApplication -Name "Search Service Application"

So if you remember in STSADM, you would have to run a command that would output the GUID for you, then run another command with the GUID included to get your desired results right?  Powershell actually stores the GUID in the $spapp variable for you.  So all you have to do is run this command and you can kiss that Service Application goodbye.

So keeping in mind that $spapp is storing the GUID for you, type the following command:

Remove-SPServiceApplication $spapp

If you would also like to remove the associated database(s), type the following command:

Remove-SPServiceApplication $spapp -RemoveData

So long story short:

$spapp = Get-SPServiceApplication -Name "Search Service Application"
Remove-SPServiceApplication $spapp

or

Remove-SPServiceApplication $spapp -RemoveData

Utilizing PowerShell to Deploy SharePoint 2010

2 comments January 31st, 2011

Standardization of SharePoint 2010 deployments are important to me, especially within the DoD. It’s my belief that standardization could minimize environmental issues while giving all of us engineers a baseline understanding of how farms have been deployed in common environments, reducing spin up to final resolution times. The use of PowerShell allows us to do this without having to rely on the user to click or not click something which lets face it, sometimes we can’t rely on ourselves to click the right thing every time, so we can’t expect it from anyone else. So let’s look at how we can install SharePoint 2010 using a script and deploy the farm using PowerShell:

I recommend following a previous blog post before implementing the steps below to insure you have prepared your operating system for SharePoint 2010:

Preparing W2K8 for SharePoint 2007/2010 Installation.

Install SharePoint 2010 PreReqs:

For each of the servers in the farm (SPAPPSVR, SPIDX, SPWFE1, and SPWFE2):

  1. Create a folder named SP2010_Build on your D:\
  2. Inside the SP2010_Build folder, create 2 more folders named Products and another named Scripts.
  3. Inside the Products folder, create another folder named SharePoint_2010_Installation.
  4. Copy your SharePoint 2010 RTM files and any updates into the D:\SP2010_Build\Products\SharePoint_2010_Installation folder.
  5. Download the SP2010_PreReq.iso file.
  6. Mount the ISO file to your operating system or burn them to a CD.
  7. Copy the folder named PrerequisiteInstallerFiles to the D:\SP2010_Build\Products\SharePoint_2010_Installation folder.
  8. Copy the file named PrerequisiteInstaller.Arguments.txt file to the D:\SP2010_Build\Products\SharePoint_2010_Installation folder.
  9. Copy the file Prereq_SP2010.cmd to the D:\SP2010_Build\Scripts\ folder.
  10. Execute Prereq_SP2010.cmd from command prompt so that you can view the output:
  11.  

    Restart Server(s)

    Continue reading…