Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Using PowerShell from TCC without a 3rd-Party DLL

Aug
2,799
144
Further to my post Use CURL to send/receive commands from a PowerShell 5.1 process

Here is a working example of sending/receiving commands/output from PowerShell 5.1 using TCC v36.

Code:
U:\>curl -s -X POST -d "$fso = New-Object -ComObject Scripting.FileSystemObject" http://127.0.0.1:8080/

U:\>curl -s -X POST -d "$fso | Get-Member" http://127.0.0.1:8080/


   TypeName: System.__ComObject#{2a0b9d10-4b87-11d3-a97a-00104b365c9f}

Name                MemberType Definition
----                ---------- ----------
BuildPath           Method     string BuildPath (string, string)
CopyFile            Method     void CopyFile (string, string, bool)
CopyFolder          Method     void CopyFolder (string, string, bool)
CreateFolder        Method     IFolder CreateFolder (string)
CreateTextFile      Method     ITextStream CreateTextFile (string, bool, bool)
DeleteFile          Method     void DeleteFile (string, bool)
DeleteFolder        Method     void DeleteFolder (string, bool)
DriveExists         Method     bool DriveExists (string)
FileExists          Method     bool FileExists (string)
FolderExists        Method     bool FolderExists (string)
GetAbsolutePathName Method     string GetAbsolutePathName (string)
GetBaseName         Method     string GetBaseName (string)
GetDrive            Method     IDrive GetDrive (string)
GetDriveName        Method     string GetDriveName (string)
GetExtensionName    Method     string GetExtensionName (string)
GetFile             Method     IFile GetFile (string)
GetFileName         Method     string GetFileName (string)
GetFileVersion      Method     string GetFileVersion (string)
GetFolder           Method     IFolder GetFolder (string)
GetParentFolderName Method     string GetParentFolderName (string)
GetSpecialFolder    Method     IFolder GetSpecialFolder (SpecialFolderConst)
GetStandardStream   Method     ITextStream GetStandardStream (StandardStreamTypes, bool)
GetTempName         Method     string GetTempName ()
MoveFile            Method     void MoveFile (string, string)
MoveFolder          Method     void MoveFolder (string, string)
OpenTextFile        Method     ITextStream OpenTextFile (string, IOMode, bool, Tristate)
Drives              Property   IDriveCollection Drives () {get}
 
Wrapping the CURL command into an alias;

Code:
U:\>ver

TCC  36.00.17 x64   Windows 10 [Version 10.0.19045.7058]

U:\>alias pshell=`curl -s -X POST -d "%$" http://127.0.0.1:8080/`

U:\>pshell get-date

April 6, 2026 1:13:06 PM


U:\>pshell get-content function:v

  & 'C:\Program Files\V64\v.exe' @args


U:\>pshell get-content function:CreateObject
param($progID)

        new-object -com $progID

Joe
 
Code:
U:\>curl --help
Usage: curl [options...] <url>
 -d, --data <data>           HTTP POST data
 -f, --fail                  Fail fast with no output on HTTP errors
 -h, --help <subject>        Get help for commands
 -o, --output <file>         Write to file instead of stdout
 -O, --remote-name           Write output to file named as remote file
 -i, --show-headers          Show response headers in output
 -s, --silent                Silent mode
 -T, --upload-file <file>    Transfer local FILE to destination
 -u, --user <user:password>  Server user and password
 -A, --user-agent <name>     Send User-Agent <name> to server
 -v, --verbose               Make the operation more talkative
 -V, --version               Show version number and quit

This is not the full help; this menu is split into categories.
Use "--help category" to get an overview of all categories, which are:
auth, connection, curl, deprecated, dns, file, ftp, global, http, imap, ldap, output, pop3, post, proxy,
scp, sftp, smtp, ssh, telnet, tftp, timeout, tls, upload, verbose.
Use "--help all" to list all options

U:\>which curl
curl is an external : C:\WINDOWS\system32\curl.exe
 
Back
Top