0

I am trying to restart an application pool remotely using powershell.

net use $ToPath $pass /USER:$usr
$appPool = get-wmiobject -computername $ToServerName -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool" | Where-Object {$_.Name -eq "W3SVC/APPPOOLS/$appPoolName"} -Authentication PacketPrivacy
#(Get-WmiObject -Query "SELECT * FROM IIsApplicationPool WHERE Name = 'W3SVC/AppPools/$appPoolName'" -Namespace 'root\MicrosoftIISv2').Recycle()
$appPool.Recycle()
net use $ToPath /delete

I basically use the same command that I use to move files remotely, where I set up a net user. I get a Get-WMI exception

SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195

1 Answers1

0

I wanted to make sure that this question was answered for those that come after me. It turns out that I was piping the -Authentication PacketPrivacy parameter to the wrong command

SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195