AnsweredAssumed Answered

How to check NWAdmin commands required -url as parameters in PowerShell?

Question asked by sivakumar on Aug 13, 2014
Latest reply on Aug 14, 2014 by

Through powershell I want to execute NWAdmin commands. I have written simple command as shown below.

$spWebURL = Read-Host "Enter Web Application URL:"

$spWebApp = Get-SPWebApplication $spWebURL

$NWAdminCommand = Read-Host "Enter NWAdmin Command to perform request action:"



foreach ($SPSite in $spWebApp.Sites)


    foreach($SPWeb in $SPSite.AllWebs)


  $SiteURL= $SPWeb.URL;


  $NWAdminCommandTest=".\NWAdmin.exe -o $NWAdminCommand -url $SiteURL";


  iex $NWAdminCommandTest;








NWAdmin commands format is shown below.

NWAdmin.exe -o PurgeWorkflowData [-workflowName workflowName] [-state[All|Running|Completed|Cancelled|Error]] [-url teamsiteUrl [-listName listName]] [-deletedLists]


How to check if user enter PurgeWorkflowData as command, is NWAdmin commands required -url as parameters?