I have written a power shell command to achieve a specific function and I'm new to power shell. That should perform the action and I'm pretty sure I have entered exact working command. But when I try to execute the command inside for each loop, it prints the command rather than executing. NWAdminCommand is my command and it gets values from user input.
$NWAdminCommand = Read-Host "Enter NWAdmin Command to perform request action"
foreach ($SPSite in $spWebApp.Sites)
{
foreach($SPWeb in $SPSite.AllWebs)
{
$NWAdminCommand;
}
}
}