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
Compiled script generates incomplete reporting
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.
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.
- Buddyblues
- Posts: 4
- Last visit: Wed Oct 04, 2017 12:25 pm
- Buddyblues
- Posts: 4
- Last visit: Wed Oct 04, 2017 12:25 pm
Re: Compiled script generates incomplete reporting
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,
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,
Re: Compiled script generates incomplete reporting
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.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,
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
Re: Compiled script generates incomplete reporting
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
http://info.sapien.com/index.php/how-to ... udio-howto