Calling a function that wraps stopping an IIS app pool. Why would the 'Name' parameter for Stop-WebAppPool have an issue? The only thing I can see is since its inside a script block?
error:
Cannot validate argument on parameter 'Name'. The argument is null. Provide a valid value for the argument, and then try running the command again.
function StopAppPool() {
param(
[string] $siteName = "",
[string] $serverName = ""
);
$session = New-PSSession -ComputerName $serverName
Invoke-Command -ComputerName $serverName -ScriptBlock { Stop-WebAppPool -Name $siteName }
}
# -- entry here
StopAppPool -siteName "my.test-server.web" -serverName "DEV-MYTEST1"