none
Running UpdateCAS.ps1 and DisableMalware.ps1 from a remote location RRS feed

  • Question

  • I am in a highly customized environment with 10+ Exchange servers as far as virtual directories and transport settings are concerned, and I'm finding that Exchange updates (CU or otherwise) has a habit of resetting a lot of these values as well as transport agent and stopping services.

    I am trying to create a script to be ran from a centralized location outside of the Exchange servers where I can fix this by resetting them back to what the customized settings are. I am however getting stuck on trying to call UpdateCAS.ps1 and DisableMalware.ps1 on the servers and running it remotely.

    At first it seemed like a CredSSP error but along with the credential error it also says that there are no virtual directories or transport agent installed, which is only true for the server I'm running the script from. My guess is that regardless of whether I import a session or invoke-command (and load Exchange extensions) it will insist of running it locally.

    When I try to Import a session:

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange 2013 server>/PowerShell/ ...
    Import-Pssession $session

    This runs the command/scripts on the local server

    However, even if I try 
    invoke-command -computer $MachineName -filepath "C:\Program Files\Exchange\v15\Bin\UpdateCAS.ps1"
    It gives me an error indicating my credentials are invalid (The supplied credential for <user> is invalid error). At first I tried different credentials and CredSSP fixes, but running that script in conjuntion with another one that fixes virtual directories gave me an error indicating that no virtual directories were installed, which is only true for the server I am issuing the command from, this makes me think that it is still running this script locally, not remotely.

    Wondering if anyone else has played around with this and if they know of a solution

    Friday, April 7, 2017 6:21 PM

All replies

  • Try opening the powershell as a different user and provide the credentials required for these scripts to run, Then do New-pssession and invoke-command.
    Monday, April 10, 2017 4:55 AM
  • I'm a domain admin, also changing credentials gives me the same error
    Monday, April 10, 2017 10:26 PM