1

I want to run sharepoint powershell script, but I have this message error:

the term '.\DeployPackages' is not recognized as the name of a cmdlet, function, script file, or operable program...

same for .\DeployWebAppPackages , .\DeploySites, .\DeploySitePackages

this is my code:

  Param ([switch]$Local=$False)

if ((Get-PSSnapin | where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
    Write-Host "Loading SharePoint Powershell snapin..." -NoNewline
    Add-PSSnapin Microsoft.SharePoint.PowerShell;
    Write-Host "DONE."
}

$DateTime = Get-Date -UFormat "%Y-%m-%d %H%M%S"
$LogDir = "$pwd\Logs"
mkdir $LogDir -ErrorAction SilentlyContinue > $null
$LogFile = "$LogDir\RunAll-$DateTime.log"
Start-Transcript -Path $LogFile -Force

Write-Host "Stopping SharePoint Timer service..."
net stop sptimerv4

Write-Host "Starting SharePoint Timer service..."
net start sptimerv4

iisreset

# TEMP: Always Force -- until we figure out how to prevent error
.\DeployPackages -Force -Local:$Local

.\DeployWebAppPackages -Force -Local:$Local
.\DeploySites
.\DeploySitePackages

# To refresh the COS2 Custom Timer job
Write-Host "Stopping SharePoint Timer service..."
net stop sptimerv4
Write-Host "Starting SharePoint Timer service..."
net start sptimerv4

Stop-Transcript

all the scripts are in the same forlder enter image description here Any help please ?

4
  • Did you try using invoke-expression ? technet.microsoft.com/en-us/library/ee176880.aspx
    – Seb
    Commented Aug 16, 2016 at 7:37
  • @Seb yes, I tried now and it's the same error.
    – BKChedlia
    Commented Aug 16, 2016 at 7:42
  • Have u tried with extension like deploypackages.ps1?
    – Waqas Sarwar MVP
    Commented Aug 16, 2016 at 8:08
  • @WaqasSarwarMCSE yes I have tried it but I have the same error message
    – BKChedlia
    Commented Aug 16, 2016 at 8:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.