Scenario: How to launch an exe and pass arguments to it using powershell?
Solution:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
$webApp = read-host "Enter the URL of the SharePoint Web app"
$contentDBs = Get-SPContentDatabase -WebApplication $webApp
foreach($cdb in $contentDBs)
{
& 'C:\test\test.exe' -webappurl $webApp -Dbname $cdb.Name
}
No comments:
Post a Comment