GithubHelp home page GithubHelp logo

Comments (6)

mkellerman avatar mkellerman commented on June 29, 2024

Try with latest PR #34.

from invoke-commandas.

wrighbr avatar wrighbr commented on June 29, 2024

Still getting the below error msg.

[localhost] Connecting to remote server localhost failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (localhost:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionStateBroken

from invoke-commandas.

wrighbr avatar wrighbr commented on June 29, 2024

Also tried running the command without the ComputerName parameter

Invoke-CommandAs -ScriptBlock $script -AsUser $Credential

A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:347 char:21
+ ...             $Using:_Function | ForEach-Object { Invoke-Expression $_  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:348 char:21
+ ...             $Using:_Using | ForEach-Object { Set-Variable -Name $_.Na ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:351 char:25
+                     If ($Using:ScriptBlock)   { $Parameters['ScriptBl ...
+                         ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:352 char:25
+                     If ($Using:ArgumentList)  { $Parameters['Argument ...
+                         ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:353 char:25
+                     If ($Using:AsUser)        { $Parameters['AsUser'] ...
+                         ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:354 char:25
+                     If ($Using:AsSystem)      { $Parameters['AsSystem ...
+                         ~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:355 char:25
+                     If ($Using:AsInteractive) { $Parameters['AsIntera ...
+                         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:356 char:25
+                     If ($Using:AsGMSA)        { $Parameters['AsGMSA'] ...
+                         ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
A Using variable cannot be retrieved. A Using variable can be used only with Invoke-Command, Start-Job, or InlineScript in the script workflow. When it is used with Invoke-Command, the Using 
variable is valid only if the script block is invoked on a remote computer.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\3.1.3\public\Invoke-CommandAs.ps1:357 char:25
+                     If ($Using:IsVerbose)     { $Parameters['Verbose' ...
+                         ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : UsingWithoutInvokeCommand
 
cmdlet Invoke-ScheduledTask at command pipeline position 1
Supply values for the following parameters:
ScriptBlock: 

from invoke-commandas.

mkellerman avatar mkellerman commented on June 29, 2024

3.1.4 has been publish to the gallery. This should work now.

from invoke-commandas.

wrighbr avatar wrighbr commented on June 29, 2024

Seems to work better but I can't ran a script with elevated rights on the localhost.

from invoke-commandas.

mkellerman avatar mkellerman commented on June 29, 2024

@wrighbr this is related to another issue #30
I fixed that one too just now #35

from invoke-commandas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.