Remote VB Script Execution Issues

Home Forums Scripting PowerShell Remote VB Script Execution Issues

This topic contains 2 replies, has 2 voices, and was last updated by  CaTBuS 2 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts

  • CaTBuS
    Member
    #167671

    [SIZE=12px]The short: I’m trying to remotely execute a VBScript that resides on a workstation.
    The long: I scripted a complicated application install/config that could not be deployed via SCCM for several reasons, primarily; the install is annoyingly profile specific. I have a base multithreaded PowerShell script that I use for things like this but am having trouble getting the vbscript to execute properly on the remote machines. The script is kicking off but not as me (local admin on all systems) and not elevated.

    Here is the scriptblock I’m using. I could use help either cleaning it up or pointing me in another direction. Also, not sure if cscript.exe or wscript.exe is proper for calling the script. Also, I do plan on rewriting the install script in PowerShell but I hate not being able to figure this out. Thanks in advance for your help Petri Community!!!!

    Code:
    [COLOR=#a82d00][COLOR=#a82d00][COLOR=#a82d00]$session[/COLOR][/COLOR][/COLOR] [COLOR=#696969][COLOR=#696969][COLOR=#696969]=[/COLOR][/COLOR][/COLOR] [COLOR=#0000ff][COLOR=#0000ff][COLOR=#0000ff]New-PSSession[/COLOR][/COLOR][/COLOR] [COLOR=#000080][COLOR=#000080][COLOR=#000080]-ComputerName[/COLOR][/COLOR][/COLOR] [COLOR=#a82d00][COLOR=#a82d00][COLOR=#a82d00]$c[/COLOR][/COLOR][/COLOR]
    [COLOR=#a82d00][COLOR=#a82d00][COLOR=#a82d00]$localPath[/COLOR][/COLOR][/COLOR] [COLOR=#696969][COLOR=#696969][COLOR=#696969]=[/COLOR][/COLOR][/COLOR] [COLOR=#8b0000][COLOR=#8b0000][COLOR=#8b0000]”C:TEMPinstall.vbs[/COLOR][/COLOR][/COLOR][COLOR=#8b0000][COLOR=#8b0000][COLOR=#8b0000]”[/COLOR][/COLOR][/COLOR]
    [COLOR=#0000ff][COLOR=#0000ff][COLOR=#0000ff]Invoke-Command[/COLOR][/COLOR][/COLOR] [COLOR=#000080][COLOR=#000080][COLOR=#000080]-Session[/COLOR][/COLOR][/COLOR] [COLOR=#a82d00][COLOR=#a82d00][COLOR=#a82d00]$session[/COLOR][/COLOR][/COLOR] [COLOR=#000080][COLOR=#000080][COLOR=#000080]-ScriptBlock[/COLOR][/COLOR][/COLOR] {[COLOR=#0000ff][COLOR=#0000ff][COLOR=#0000ff]Start-Process[/COLOR][/COLOR][/COLOR] [COLOR=#000080][COLOR=#000080][COLOR=#000080]-Wait[/COLOR][/COLOR][/COLOR] [COLOR=#000080][COLOR=#000080][COLOR=#000080]-FilePath[/COLOR][/COLOR][/COLOR] [COLOR=#8b0000][COLOR=#8b0000][COLOR=#8b0000]”wscript.exe”[/COLOR][/COLOR][/COLOR] [COLOR=#000080][COLOR=#000080][COLOR=#000080]-ArgumentList[/COLOR][/COLOR][/COLOR] [COLOR=#8b0000][COLOR=#8b0000][COLOR=#8b0000]”””[/COLOR][/COLOR][/COLOR][COLOR=#a82d00][COLOR=#a82d00][COLOR=#a82d00]$using:localPath[/COLOR][/COLOR][/COLOR][COLOR=#8b0000][COLOR=#8b0000][COLOR=#8b0000]”””[/COLOR][/COLOR][/COLOR] [COLOR=#000080][COLOR=#000080][COLOR=#000080]-Verb[/COLOR][/COLOR][/COLOR] [COLOR=#8a2be2][COLOR=#8a2be2][COLOR=#8a2be2]RunAs[/COLOR][/COLOR][/COLOR]}

    [/SIZE]


    CaTBuS
    Member
    #309116

    Update: I figured out my problem. The Invoke-Command is executing on the remote session as “ME” instead of the current logged on user. Is there anyway to have this code execute as the logged on user but with my credentials?


    wullieb1
    Participant
    #245817

    As far as i’m aware you won’t be able to do this without the users credentials.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.