#201818  - 2011-03-30  04:21 AM  
 
Re: Com Interface to Powershell 
 
[Re:  Allen ]
 
 
 
Benny69  
Moderator 
 
 
Hey Allen, 
 
  
Top 
 
 
 
 
 
 
 
#203211  - 2011-10-07  06:07 PM  
 
Re: Com Interface to Powershell 
 
[Re:  Benny69 ]
 
 
 
Allen  
KiX Supporter 
 
 
My latest use of the .net / ActiveXPoSH dll... MD5 and SHA1 Checksum/Hash 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  
KiX Supporter 
 
 
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  
KiX Supporter 
 
 
It seems Sapien has made it harder to find this download.  As of 2018/06/05 it can be found with the following instructions.http://www.sapien.com https://www.sapien.com/downloads#  
 
  
Top 
 
 
 
 
 
 
 
Moderator:  Shawn , ShaneEP , Ruud van Velsen , Arend_ , Jochen , Radimus , Glenn Barnas , Allen , Mart   
 
 
 
0 registered
and 550 anonymous users online.