PS C:\logfiles> dir
Directory: C:\logfiles
Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 12/11/2013 2:54 PM 50707 Detail_LandingPage.txt -a--- 12/12/2013 10:36 AM 1641 Post-KJUninstall.ps1
PS C:\logfiles> Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFiles\Detail_La ndingPage.txt }" Unexpected token '}' in expression or statement. At line:1 char:80 + Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFiles\Detail_LandingPage.txt } <<<< " + CategoryInfo : ParserError: (}:String) [], ParentContainsErrorR ecordException + FullyQualifiedErrorId : UnexpectedToken
PS C:\logfiles> Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFiles\Detail_La ndingPage.txt"
Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFiles\Detail_LandingPage.txt " The term 'Post-KJUninstall.ps1' is not recognized as the name of a cmdlet, func tion, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:21 + Post-KJUninstall.ps1 <<<< -UninstallLogFilePath C:\LogFiles\Detail_LandingPa ge.txt" + CategoryInfo : ObjectNotFound: (Post-KJUninstall.ps1:String) [] , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\logfiles> PS C:\logfiles> Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFiles\Detail_La ndingPage.txt"
> > > >
Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFiles\Detail_LandingPage.txt " The term 'Post-KJUninstall.ps1' is not recognized as the name of a cmdlet, func tion, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:21 + Post-KJUninstall.ps1 <<<< -UninstallLogFilePath C:\LogFiles\Detail_LandingPa ge.txt" + CategoryInfo : ObjectNotFound: (Post-KJUninstall.ps1:String) [] , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\logfiles> Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFiles\Detail_La ndingPage.txt The term 'Post-KJUninstall.ps1' is not recognized as the name of a cmdlet, func tion, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:21 + Post-KJUninstall.ps1 <<<< -UninstallLogFilePath C:\LogFiles\Detail_LandingPa ge.txt + CategoryInfo : ObjectNotFound: (Post-KJUninstall.ps1:String) [] , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\logfiles> c:\LogFiles\Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFil es\Detail_LandingPage.txt The term 'c:\LogFiles\Post-KJUninstall.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the n ame, or if a path was included, verify that the path is correct and try again. At line:1 char:33 + c:\LogFiles\Post-KJUninstall.ps1 <<<< -UninstallLogFilePath C:\LogFiles\Deta il_LandingPage.txt + CategoryInfo : ObjectNotFound: (c:\LogFiles\Post-KJUninstall.ps 1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
PS C:\logfiles> c:\LogFiles\Post-KJUninstall.ps1 -UninstallLogFilePath C:\LogFil es\Detail_LandingPage.txt
Param($UninstallLogFilePath)
$file = $UninstallLogFilePath
Add-PSSnapin Microsoft.SharePoint.PowerShell
$powerPivotFeatures = @("1a33a234-b4a4-4fc6-96c2-8bdb56388bd5", "e9c4784b-d453-46f5-8559-3c891d7159dd", "f8c51e81-0b46-4535-a3d5-244f63e1cab9")
$premiumSiteId = "8581a8a7-cf16-4770-ac54-260265ddb0b2"
#Remove PowerPivot features
foreach($featureId in $powerPivotFeatures)
{
if(Get-SPFeature | where {$_.Id -eq $featureId})
{
Write-Host "Found feature $featureId"
Uninstall-SPFeature -Id $featureId -force
}
}
# Verify if the premium site feature was indeed removed
$premiumSiteFeature = Get-SPFeature | where {$_.Id -eq $premiumSiteId}
if($premiumSiteFeature -eq $null)
{
# Re-install the feature
Install-SPFeature -path PremiumSite
}
switch -regex -file $file
{
"de-activating feature" {
# This will return every entry in the file for feature deactivation
$Url = $_.Split() | ?{$_ -match "http://([a-zA-Z0-9_\-]+)([\.][[a-zA-Z0-9_\-]+)*(\:[0-9]+)*(/\S*)?"}
#Remove the period at the end
$Url = $Url.Substring(0, $Url.Length – 1)
# Match the Guid for the feature
$Id = $_.Split() | ?{$_ -match "([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}"}
if(!($powerPivotFeatures -contains $Id))
{
Write-Host "Re-activating feature $Id on site $Url"
Enable-SPFeature -Id $Id -Url $Url
trap
{
Write-Host "Could not Re-activate feature $Id on site $Url"
Write-Host $("Exception: "+ $_.Exception.Message);
continue
}
}
continue
}
}