Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Read specific amount of string data from a (log) file at a given offset like you might see being written in a SysInternals procmon trace
- $fileStream = New-Object System.IO.FileStream( "path_to_logfile_to_read" , [System.IO.FileMode]::Open , [System.IO.FileAccess]::Read )
- [int]$offset = 132433
- $fileStream.Seek( $offset , [System.IO.SeekOrigin]::Begin )
- [int]$bufsize = 4123
- $chunk = New-Object byte[] $bufSize
- $fileStream.Read( $chunk , 0 , $bufsize )
- $fileStream.Close()
- [System.Text.Encoding]::ASCII.GetString( $chunk )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement