Page 2 of 2 <12
Topic Options
#201818 - 2011-03-30 04:21 AM Re: Com Interface to Powershell [Re: Allen]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Hey Allen,
Just reading thru your thred, cool stuff, i will have to play with this, i luv the .net stuff.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#203211 - 2011-10-07 06:07 PM Re: Com Interface to Powershell [Re: Benny69]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
My latest use of the .net / ActiveXPoSH dll... MD5 and SHA1 Checksum/Hash

Borrowed code from: http://www.tinyint.com/index.php/2011/09/14/get-an-md5-or-sha1-checksum-with-powershell/

break on
$RC=setoption("NoVarsInStrings","on")
$RC=setoption("NoMacrosInStrings","on")
$RC=setoption("WrapATEOL","on")
 
? GetCheckSum(@scriptdir + "\ActiveXPoSH.exe","MD5") ? GetCheckSum(@scriptdir + "\ActiveXPoSH.exe","SHA1")

Function GetCheckSum($file, $algorithm, optional $PSObject) if $PSobject="" $PSObject=CreateObject("SAPIEN.ActiveXPoSH") endif if $PSObject.init(not 0) if exist($file) $PSObject.execute('$fs = new-object System.IO.FileStream "' + $file + '", "Open"') $PSObject.execute('$algo = [type]"System.Security.Cryptography.' + $Algorithm + '"') $PSObject.execute('$crypto = $algo::Create()') $PSobject.execute('$hash = [BitConverter]::ToString($crypto.ComputeHash($fs)).Replace("-", "")') $PSObject.execute('$fs.Close()') $GetChecksum=$PSObject.getvalue('$hash') else exit 2 endif endif endfunction

Top
#204276 - 2012-02-10 07:00 PM Re: Com Interface to Powershell [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
How to determine if an EXE is 16bit, 32bit (x86), or 64bit (x64)...

break on
$RC=setoption("NoVarsInStrings","on")
$RC=setoption("NoMacrosInStrings","on")
$RC=setoption("WrapATEOL","on")
 
? PSGetBinaryType('%systemroot%\notepad.exe')
? PSGetBinaryType(@scriptdir + '\kix32.exe')
 
function PSGetBinaryType($FQFN, optional $PSObject) dim $result,$values[7] $values="Windows 32bit","MSDOS","Windows 16bit","PIF","POSIX","OS/2 16bit","Windows 64bit" if $PSobject="" $PSObject=CreateObject("SAPIEN.ActiveXPoSH") endif if exist($FQFN) if $PSObject.init(not 0) $PSGetBinaryType=-1 $PSObject.Execute("$sig='" + '[DllImport("kernel32.dll")]' + @CRLF + 'public static extern bool GetBinaryType(string lpApplicationName,ref int lpBinaryType);' + "'") $PSObject.Execute('$GetBinaryType=Add-Type -memberDefinition $sig -namespace Win32Functions -name "BinaryType" -passThru') $PSObject.Execute('$ReturnedType = -1') $Result=$PSObject.GetValue('$GetBinaryType::GetBinaryType("' + $FQFN + '",[ref] $ReturnedType)') if $result="True" $PSGetBinaryType=$values[$PSObject.Getvalue('$ReturnedType')] endif endif endif endfunction

Top
#213343 - 2018-06-05 11:06 PM Re: Com Interface to Powershell [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
It seems Sapien has made it harder to find this download. As of 2018/06/05 it can be found with the following instructions.

1. Go to http://www.sapien.com
2. Sign in or Create an account (free)
3. Go here: https://www.sapien.com/downloads#
4. Click the "Free Components" folder in the left panel
5. In the right panel, you will see ActiveXPoshv2, ActiveXPoshV3x86 and ActiveXPoshV3x64

Top
Page 2 of 2 <12


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 514 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.056 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org