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 ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.