Running AutoSPInstaller within remote PS session

Topics: General Questions, Support
Feb 29 at 10:25 PM
Can AutoSPInstaller be run under remote PS session?

Say, there is an Azure server in the domain. Connecting via New-PSSession, and the running the following script:
Write-Host "Runnin on: [$env:COMPUTERNAME]"
Write-Host "$env:USERDOMAIN \ $env:USERNAME"

cd "C:\_install\SharePoint\AutoSPInstaller\SP\AutoSPInstaller"
& ".\AutoSPInstallerMain.ps1" AutoSPInstallerInput-test.xml "" "" $true
Run fails with the following output:
-----------------------------------
| Automated SP2013 install script |
| Started on: 29/02/2016 10:13:19 PM |
-----------------------------------
 - Install based on: 
  - AutoSPInstallerInput-test.xml 
  - Environment: Dev 
  - Version: 3.99.51
--------------------------------------------------------------
 - Validating user accounts and passwords...
 - Account "test\defaultadmin" (Account)...Invalid!
 - Account "test\defaultadmin" (ManagedAccount)...Invalid!
 - Account "test\defaultadmin" (ManagedAccount)...Invalid!
 - Account "test\defaultadmin" (ManagedAccount)...Invalid!
 - Account "test\defaultadmin" (ManagedAccount)...Invalid!
 - Account "test\defaultadmin"...--------------------------------------------------------------
 - Script halted!
-----------------------------------
| Automated SP2013 install script |
| Started on: 29/02/2016 10:13:19 PM |
| Aborted:    29/02/2016 10:13:26 PM |
-----------------------------------
Press any key to exit...
Exception calling "ReadKey" with "1" argument(s): "The method or operation is not implemented."
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : RemoteException
    + PSComputerName        : ci-test-vm-1
 
Disconnecting from VM:[ci-test-vm-1]


Exception             : System.Management.Automation.MethodInvocationException: Exception calling "FindAll" with "0" argument(s): "An operations error occurred.
                        " ---> System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred.
                        
                           at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
                           at System.DirectoryServices.DirectoryEntry.Bind()
                           at System.DirectoryServices.DirectoryEntry.get_AdsObject()
                           at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
                           at CallSite.Target(Closure , CallSite , Object )
                           --- End of inner exception stack trace ---
                           at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
                           at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject          : 
CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : DirectoryServicesCOMException
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at userExists, C:\_install\SharePoint\AutoSPInstaller\SP\AutoSPInstaller\AutoSPInstallerFunctions.ps1: line 7430
                        at ValidateCredentials, C:\_install\SharePoint\AutoSPInstaller\SP\AutoSPInstaller\AutoSPInstallerFunctions.ps1: line 122
                        at PrepForInstall, C:\_install\SharePoint\AutoSPInstaller\SP\AutoSPInstaller\AutoSPInstallerMain.ps1: line 169
                        at <ScriptBlock>, C:\_install\SharePoint\AutoSPInstaller\SP\AutoSPInstaller\AutoSPInstallerMain.ps1: line 378
                        at <ScriptBlock>, <No file>: line 8
PipelineIterationInfo : {}
PSMessageDetails      : 
The same script works well being executed via RDP, all works well. Once under PS Remoting - yep, fails.

What can be done with it, or there is a better way to get things done remotely?
Feb 29 at 11:20 PM
Ohh. seems to be WinRM config issues at my end. Credssp should be configured correctly.
Mar 1 at 12:54 AM
Can be closed.

Incorrect CredSSP config for WinRm at my side gave tons of funky errors. Pretty much, double hop thing resulting into half of the AutoSPInstaler functions not working, such as querying AD and so on.

Gosh :)
Marked as answer by brianlala on 3/1/2016 at 8:14 AM