invoke-command vs. enter-pssession

This topic contains 5 replies, has 4 voices, and was last updated by  Mark Prior 8 months ago.

  • Author
    Posts
  • #64611

    Matt Angelo
    Participant

    When I use invoke-command to start a Dell bios config .exe on a remote machine the exe starts but does not complete the job until I log onto the computer with an Admin acct. If I enter-pssession and start the same exe it completes thoroughly. Any ideas?

  • #64786

    Don Jones
    Keymaster

    It is likely failing because the installer requires an active profile to run the executable, which is not what you get when you run Invoke-Command. It's a poorly made installer, in other words; unless you can repackage it somehow, there's not really a workaround.

  • #64815

    Matt Angelo
    Participant

    Thank you so much for the insight Don.

  • #64840

    Daniel Krebs
    Moderator

    If you're on Windows 8/2012 or later, you could create a temporary scheduled task to run the bios config command. As alternative if you're configuring a desktop or laptop you could try to use the Dell BIOS PowerShell module which you can download from their homepage.

  • #64687

    Mark Prior
    Participant

    im guessing it will be using local non admin creds to run the invoke command

    try this

    $Username = "Domain\Username
    	$Password = ConvertTo-SecureString "Passwordgoeshere" -AsPlainText -Force
    	$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
    
    Invoke-Command -Credential $creds {
    
    Do Stuff here 
    
    }
    
  • #64689

    Mark Prior
    Participant

    It will be running as local machine user rather than with your admin creds

    $Username = "domain\username"
    $Password = ConvertTo-SecureString "password goes here" -AsPlainText -Force
    $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password

    invoke-command -credential $cred {

    Do Stuff Here

    }

You must be logged in to reply to this topic.