Comments (4)
Invoke-CommandAs -Credential $adminUser -AsSystem -ScriptBlock { ... }
Look at the examples in the README.md
from invoke-commandas.
You need to pass the -Credential parameter to auth to the vm. -AsUser will use that user to create and run the scheduled job.
One cred to auth to the vm, another to run the scripblock as (if different).
from invoke-commandas.
You need to pass the -Credential parameter to auth to the vm. -AsUser will use that user to create and run the scheduled job.
One cred to auth to the vm, another to run the scripblock as (if different).
Thanks very much for the reply.. I think I get what you mean, however how would this look script wise?
Kind regards
from invoke-commandas.
Get the same result but when running in system context and trying to run scriptblock AsUser.
Testing with this:
$Credential = Get-Credential domain\user
$ScriptBlock = { [System.Security.Principal.Windowsidentity]::GetCurrent() }
Invoke-CommandAs -ScriptBlock $ScriptBlock -AsUser -$Credential
and the user is not local admin but have rights to create tasks, have tried it manually.
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
- Interactive Execution as SYSTEM Fails to Launch in Visible Session HOT 1
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.