Compiled script generates incomplete reporting

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 7 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Buddyblues
Posts: 4
Last visit: Wed Oct 04, 2017 12:25 pm

Compiled script generates incomplete reporting

Post by Buddyblues »

Disclaimer: New to Powershell scripting.

I have written the following script to enumerate folder paths listed in a text file, and calculate a file hash for each file in the given path.
The script outputs the algorithm, hash , and full file path.

The script works but when I compiled in Powershell Studio 2017, the reporting is incomplete; missing the file path.

Can someone help troubleshoot?

$Author = 'Author'
$Time = Get-Date -Format HH-mm-ss
$Date = Get-Date -Format yyyy-MM-dd
$FileDateStamp = Get-Date -Format yyyy-MM-dd_HH-mm
$Title = "File Hash Report"
$LogName = "TESTHash_Results_" + $FileDateStamp
$LogFile = $LogName + ".log"
$Log = "D:\CodePromotionHashes" + "\" + $LogFile


Set-PSBreakpoint -Variable Time -Mode Read -Action { $global:Time = Get-Date -format "HH:mm:ss.fff" } | Out-Null

If((Test-Path $Log) -eq $False){ New-Item $Log -ItemType "File" -Force | Out-Null }
Else { $Null }

"[$Time][Startup]" | Out-File $Log -Append
"$Title" | Out-File $Log -Append
"Script written by: $Author" | Out-File $Log -Append
"Script executed from: $($env:Computername)" | Out-File $Log -Append
"Script executed on: $Date" | Out-File $Log -Append

"[$Time] TEST Systems:" | Out-File $Log -Append
#DEV
Get-ChildItem "C:\tmp1" -Filter *.txt | Get-FileHash -Algorithm SHA1 | Out-File $Log -Append
Get-ChildItem "C:\tmp2" -Filter *.txt | Get-FileHash -Algorithm SHA1 | Out-File $Log -Append

Get-ChildItem "\\Infra-PC\C$\tmp1" -Filter *.txt | Get-FileHash -Algorithm SHA1 | Out-File $Log -Append
Get-ChildItem "\\Infra-PC\C$\tmp2" -Filter *.txt | Get-FileHash -Algorithm SHA1 | Out-File $Log -Append
"[$Time][Finish] Script completed." | Out-File $Log -Append
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Compiled script generates incomplete reporting

Post by jvierra »

Try this:
Out-File -Width 120
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Compiled script generates incomplete reporting

Post by jvierra »

This also works:
Get-ChildItem -Filter *.txt | Get-FileHash -Algorithm SHA1 |select hash,path,Algorithm
User avatar
Buddyblues
Posts: 4
Last visit: Wed Oct 04, 2017 12:25 pm

Re: Compiled script generates incomplete reporting

Post by Buddyblues »

Thanks jvierra,

Explicitly calling our the fields worked like a charm.

I'll be purchasing 4 Studio licenses for my company(1 is mine). Is there a training/how to guide on using/creating GUIs and the like?

Thanks,
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Compiled script generates incomplete reporting

Post by jvierra »

Buddyblues wrote:Thanks jvierra,

Explicitly calling our the fields worked like a charm.

I'll be purchasing 4 Studio licenses for my company(1 is mine). Is there a training/how to guide on using/creating GUIs and the like?

Thanks,
I recommend that you post all questions like this in the pre-sales customer support forum or call into Sapien sales. They will be glad to assist you in these matters.

Here is a good place to start: viewforum.php?f=8

Be sure to ask them about training.

Here is the contact page with numbers and email for most topics: https://www.sapien.com/company/contact


Good luck
Alcha212
Posts: 9
Last visit: Fri Jan 25, 2019 6:52 pm

Re: Compiled script generates incomplete reporting

Post by Alcha212 »

You can also check out the info.sapien.com page, they have some helpful guides there:

http://info.sapien.com/index.php/how-to ... udio-howto
This topic is 7 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked