RUNAS /Netonly

This topic contains 1 reply, has 2 voices, and was last updated by  Jack 8 months, 1 week ago.

  • Author
    Posts
  • #64026

    Chris
    Participant

    Hi
    New PS user trying to get to grips with it and am now forcing myself to not use the GUI to configure my servers unless I have too...
    I figure I'll learn more quicker that route...

    However I do need to do some tasks via MMC for now, but as I'm not a member of the domains I manage (MSP) my laptop needs to use an network runas to elevate and then launch MMC as the domain user...
    And for fun I thought I'd try to PS that process!
    This works, but only if I do it line by line into the window, if I run it as a script it doesn't pause to wait for the password input, but runas /netonly is actually a CMD rather than a PS

    $domainuser= Read-Host -Prompt 'Enter domain user in the format Domain\Username'
    $fqdn= Read-Host -Prompt 'Enter Management Target FQDN'
    runas /netonly /user:$domainuser “mmc /server=$fqdn"

    So does anyone know how to take creds and then launch mmc as a remote domain user? Any advice would be awesome!

  • #64039

    Jack
    Participant

    I'm not currently at a machine with PS so can't test.
    But you could use something like

    Start-Process mmc -ComputerName $FQDN -Credential $DomainUser
    

You must be logged in to reply to this topic.