Comments (6)
Try with latest PR #34.
from invoke-commandas.
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.
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.
3.1.4 has been publish to the gallery. This should work now.
from invoke-commandas.
Seems to work better but I can't ran a script with elevated rights on the localhost.
from invoke-commandas.
@wrighbr this is related to another issue #30
I fixed that one too just now #35
from invoke-commandas.
Related Issues (20)
- Unable to invoke command as gMSA - v3.1.2 HOT 11
- Access Denied with -RunElevated HOT 3
- AsUser Doesn't Impersonate user HOT 10
- Removing entries from the Task Scheduler log HOT 3
- $Using: variable preface not respected HOT 6
- Module on Powershell Core HOT 2
- Erro running RunElevated parameter HOT 4
- Support for PowerShell 7 HOT 12
- PowerShell Core Compatiblility HOT 2
- Not working when using variables in script block HOT 3
- Can't figure out the right amount of permission HOT 2
- Unable to submit credential objects as arguments HOT 6
- AsSystem doesn't seem to execute while device is on battery power HOT 4
- Would it be possible to run -AsLocalService HOT 1
- Invoke-CommandAs -AsSystem broke on 2012 R2 ENG
- Add support for Network Service HOT 1
- Add tagging to Azure pipeline for releases HOT 2
- parsing error when using -FilePath HOT 3
- Calling via NT Authority\SYSTEM - requires elevation? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from invoke-commandas.