Simplifying getting a summary for your scripts. I will assume you are writing script often and you want to be more organized with your scripts. When writing script it is always a good idea to make sure you have enough information about your code. Following example will demonstrate same end goal. in the example given below, when writing script within the scripts following notation is used.
#(1)_.Adding Vars
#(2)_.Check folder existence
#(3)_.Entering loop
#(4)_.Setting counter
after making sure script is built correctly , you can run below function to grab all lines includes pattern defined "#" and use can use it within the script to present summary information.
<#
.NOTES #------------------------------------------------------ # Script :
Untitled18.ps1 # Created : ISE
3.0 # Author(s) :
(Casey.Dedeal) # Date :
03/07/2021 08:56:40 # Org :
CloudSec365 # File Name :
Untitled18.ps1 # Comments : None # Assumptions : None #------------------------------------------------------
.SYNOPSIS :
Untitled18.ps1 .DESCRIPTION :
Following script, .License : Open
license .Limitations : None .Known issues : None .Credits :
(Casey.Dedeal) .Blog :
https://simplepowershell.blogspot.com .Blog :
https://msazure365.blogspot.com .Blog :
https://cloudsec365.blogspot.com .Twitter :
https://twitter.com/Message_Talk
.EXAMPLE
.\Get-Sample.ps1 MAP: -----------
#(1)_.Adding Vars #(2)_.Check folder existence #(3)_.Entering loop #(4)_.Setting counter
-----------
#> |
function Function-Print-MAP { [cmdletbinding()] param(
[parameter(
Mandatory = $true,
ValueFromPipeline = $true)]
[string]$Filepath,
$pipelineInput )
Begin {
}
Process { Try{
#(1)_.Check to make
sure filepath exist
If (!(Test-Path $Filepath)){
Write-Host 'CANNOT locate file' -ForegroundColor White -BackgroundColor Red
Write-Host 'Script will stop' -ForegroundColor Yellow
break;
} #(2)_.Catch pattern
$pattern = "#"
$report = get-content $filePath -ReadCount 1000 | foreach { $_ -match $pattern }
$report | Foreach
{$_.TrimEnd()} $report $report | Out-GridView
}Catch{
$errofile = $($PSItem.ToString())
Write-Warning 'Error has occoured'
Write-host 'Problem FOUND' $errofile -ForegroundColor red -BackgroundColor Black
}
}
End {
}
}
$filepath = "C:\TEMP\KFM-SET-Health-CHECK-V1.ps1" Function-Print-MAP -Filepath $filepath |
Azure Solutions Architect
AWS Certified Cloud Practitioner
Azure Certified Security Engineer Associate
https://simplepowershell.blogspot.com
https://cloudsec365.blogspot.com
https://msazure365.blogspot.com
https://twitter.com/Message_Talk
13 comments:
Hey ,
Great Job . You Know what ?
I read a lot of blog posts and I never heard of such a topic. I love the subject you have done about bloggers. Very simple. I am also writing a blog related to the Germany job seeking visa. You can also see this.
Hi,
If you have any issues related to QuickBooks like
Download QuickBooks File Doctor
QuickBooks Statement Writer Issues
QuickBooks Error Code C=44
QuickBooks Error Code 64
QuickBooks Error Code 7300
or any other QuickBooks issues then contact our support team to resolve your issues within time.
Thanks for sharing this blog.
If you install Norton 360 Antivirus and you face issue then click here to know How to Install Norton 360 Antivirus easily without any help.
Any sensible individual would concur that you are searching for a really inclined in the direction of way over regulate rapidly and enough Buy Instagram allies from idigic likes? You are following some huge individuals. Various individuals have attempted collected framework, yet the issue is that they aren't getting the outcomes.
Ar mobile skin is a company that provides templates for mobile skins. They are responsible for designing high-quality, pixel perfect images to be used as the background of your phone. The company believes in simplicity and minimalism, which can be seen through their designs.
Vectorgi is a company that offers apple phone skin templates to allow people to cover their phones with photos, patterns, and graphics in order to personalize their phone. Vectorgi's mission is simple: Bring your personality front and center on your device.
In this article, we'll address standard deals concerning Instagram present saving and how on let know with respect to whether an Instagram post was saved in your record.How to Tell If a Instagram Post was Saved In Your account
Is it true that you are prepared to make your Device Cool? MLCut gives prepared to-cricut Portable, PC, gaming control center, Robots, and watches skin formats.click here
Hello! It's important that you don't use too much passive voice when writing itchy text. But not all students are able to notice such a mistake. The easiest way to check the active voice in your text is to use our tool. Our assistant will check if you have used too much passive voice in the text and convert it to active! https://www.passivetoactive.com/
To check my text work, I started using the english tense identifier in practice, which helped me identify various grammatical errors! This tool is easy to use and all you have to do is add some text to the tool and wait for the verification to complete. After that, you can analyze the mistakes made and correct them!
Nowadays, when teachers and tutors use their own programs to check texts, a method for checking the text for plagiarism and spelling errors is required. And there is a free online service that works quickly and reliably for this. The tool is simple to use and consistently produces the best results. Try it, and believe me, you will be pleasantly surprised. For more information, go check out the source right now!
Source: https://www.runonchecker.com/
buy instagram views uk is a pivotal electronic redirection showing connection that has possible consideration with helping affiliations and individuals with aiding their web put together presence with respect to Instagram. We give unmatched level, certified likes to help with expanding responsibility and conspicuous quality on this popular virtual redirection stage.
With a wide variety of festive styles, from elegant script to playful holiday-themed fonts, the Christmas font generator free caters to every mood and occasion. Bring your creative ideas to life and make this season extra special with personalized, professional-looking designs in just a few clicks!
Post a Comment