Results 1 to 2 of 2

Thread: Execute a PowerShell .ps1 script or a PowerShell command(s)

  1. #1
    Member
    Join Date
    Feb 2023
    Location
    London, Ontario, Canada
    Posts
    52
    Rep Power
    15

    Execute a PowerShell .ps1 script or a PowerShell command(s)

    Here's a 64-bit COM .dll that I created to execute a PowerShell .ps1 script,
    or a PowerShell command(s),
    from thinBasic.

    GitHub - JoeC4281/PSCom: PowerShell COM dll to run .ps1 files from VBScript

    Here's an example use with thinBasic;
    uses "Console"
    ' Uses "Trace"
    
    
    dim ps as iDispatch
    dim result as string
    
    
    printl "Creating PSCom.PSScript object"
    
    
    ps = CreateObject("PSCom.PSScript")
    
    
    if IsComObject(ps) then
      result = ps.ExecuteScript("e:\utils\winver.ps1")
    
    
      printl result
      
      result = ps.ExecuteCommand("Get-Date; 2025-1959")
      
      Printl result
    Else
      Printl "Could not create PSCom.PSScript object"
    end if
    
    
    ps = Nothing
    
    As this is a 64-Bit COM .dll,
    you'll need to create a dllsurrogate for PSCom.dll,
    so that it can be used from 32-Bit thinBasic.

    Instructions for doing this are in the README.md file.

    Not ready for production use,
    but can be used for testing purposes.

    Joe

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,159
    Rep Power
    736
    Hi Joe,

    thank you very much for sharing the project with the community.

    I appreciate the detailed README and extra transparency having the code on GitHub as well.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. Invoking thinBasic from Powershell
    By Benjamin in forum thinBasic General
    Replies: 2
    Last Post: 15-12-2023, 07:59
  2. Time to execute
    By Michael Clease in forum thinBasic General
    Replies: 8
    Last Post: 03-02-2010, 11:18
  3. Execute simple OS command
    By rtconstant in forum thinBasic General
    Replies: 10
    Last Post: 28-05-2008, 21:00
  4. Next Windows PowerShell will have GUI
    By ErosOlmi in forum Software discussion
    Replies: 1
    Last Post: 07-05-2008, 08:44
  5. windows nt command script
    By sandyrepope in forum Shout Box Area
    Replies: 2
    Last Post: 21-10-2007, 09:50

Members who have read this thread: 5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •