GithubHelp home page GithubHelp logo

Comments (4)

mkellerman avatar mkellerman commented on September 26, 2024 1

Invoke-CommandAs -Credential $adminUser -AsSystem -ScriptBlock { ... }

Look at the examples in the README.md

from invoke-commandas.

mkellerman avatar mkellerman commented on September 26, 2024

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.

delishus avatar delishus commented on September 26, 2024

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.

afriberg avatar afriberg commented on September 26, 2024

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)

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.