Last active
February 25, 2025 18:14
-
-
Save JohnL4/95a02aab6a80057be7454167cd593fca to your computer and use it in GitHub Desktop.
Use a remote session to pull info out of a remote file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Casting hashtable to PSCustomObject must be on one line, afaict. | |
# -split uses regexp, so '|' must be escaped | |
icm { cd f:\DataPump/logs; cat ImportData2Snowflake_20250224.log, ImportData2Snowflake_20250225.log | sls '\| Destination:' | % { | |
$arr = $_ -split ' \| '; | |
[PSCustomObject] @{TimeStamp = get-date $arr[0]; Note = $arr[5]; FieldCount = $arr.Count; FullText=$_ } | |
} | ? {$_.TimeStamp -ge (get-date '2025-02-24T22:00+00:00')} } -session $ses | select TimeStamp,Note | ft -au -wr | |
# Could also use just 'cat -tail 200 -wait' to tail the file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment