PowerShell Modifying your profile for better days
Following article will help
you to ne organized and set you up with better PS and ISE management.in order
to set yourself up all you need to do is to copy and paste functions I have
added on this article. Following same logic you can set your own working environment
to become more efficient.
#(1)_.Environment
Functions Starts
#(1)_.Environment Functions Starts #------------------------------------------------------ function Function-Set-Headers { #_.Setting up PS Console Title $comp = $env:computername $dom = $env:userdomain $usr = $env:username $host.ui.RawUI.WindowTitle
= “ISE PowerShell + [$usr]” #_.Welcome Message Entering PS Write-host '-----------------------------------------' -f Green "Name : " + $usr "Domain : " + $dom "PCname : " + $comp Write-host '-----------------------------------------' -f Green }Function-Set-Headers |
#(2)_.Verify
the path exists, create the folder if it's not found
#(2)_.Verify the path exists, create the folder if it's not
found function Function-Create-Folder-V1 {
$luser = $env:username $LocalPath = "A:\S_Root_2020\" if(
( Test-Path $LocalPath ) -eq $false ) { New-Item $LocalPath -Type Directory -Force | Out-Null Set-Location $LocalPath | Out-Null
}}Function-Create-Folder-V1 |
#(3)_.Create
Profile if Does not exist
#(3)_.Create Profile if Does not exist function Function-Create-Profile { if
(!(test-path $profile )) {new-item -type file -path $profile -force | Out-Null}
}Function-Create-Profile |
#(4)_.Function
--- Set-hash-symbol
#(4)_.Function --- Set-hash-symbol Function Prompt
{
return "#"; } |
#(5)_. Function --- Set-hash-symbol function Function-Add-Synopsis{ $header = @” <# .NOTES #------------------------------------------------------ # Script : $(split-path -Path $psISE.CurrentFile.FullPath -Leaf) # Created : ISE 3.0 # Author(s) : ($env:username) # Date : $(Get-Date) # Org :
CloudSec365 # File Name : $(split-path -Path $psISE.CurrentFile.FullPath -Leaf) # Comments : None # Assumptions : None #------------------------------------------------------ .SYNOPSIS : $(split-path -Path $psISE.CurrentFile.FullPath -Leaf) .DESCRIPTION :
Following script, .License : Open
license .Limitations : None .Known issues : None .Credits : ($env:username) .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: ----------- <Goes here> ----------- #> “@ $psise.CurrentFile.Editor.InsertText($header) }
|
Casey, Dedeal
Azure Solutions
Architect
AWS Certified Cloud
Practitioner
https://simplepowershell.blogspot.com
https://cloudsec365.blogspot.com
https://msazure365.blogspot.com
https://twitter.com/Message_Talk
No comments:
Post a Comment