Search results for #powershelltip
#PowershellTip: if you want somewhat equiv of multi thread capabilities when invoking remote commands/scripts, build a foreach loop and use start-job to kick off the scripts on each remote machine. Can also monitor all jobs progress in one window with get-job ran on each system
#PowerShellTip: To change your prompt, use the following syntax: function prompt { 'Test: ' + (Get-Location) + '> '} You can then retrieve the contents of the function with the following: Get-Content function:\prompt
#PowerShellTip: You can add registry hives/directory locations to a stack, and navigate through that stack using *location cmdlets such as push-location, set-location, get-location and pop-location
#PowerShellTip: if you want to open the current directory you're in in file explorer, type "ii ."
#sqltip #powershelltip #dostip #checkport powershell tnc <hostname> -port <num> e.g. tnc winpc1 -port445 "WARNING: TCP Connect to winpc1:445 failed"
#PowerShellTip: Uncover the mystery! When deobfuscating PowerShell, peek into the scope with Get-Variable -Scope <YourScope> and unveil variables with Get-Variable -Name YourPattern*. 🔍💻 #InfoSecInsights #PowerShellDeobfuscation #cybersecuritytips
#PowershellTip: In order to call variables you've created locally when invoking remote commands, you must assign a scope to the variable in your scriptblock. Example: $Myvar = "hello world" Invoke-command <remote_hostname> -scriptblock { $Using:myvar >> out-file.txt }
#PowershellTip: Need a conditional to check if a provided path exists and is a directory or a file? Use test-path, example: File: If (Test-Path <path> -Leaf){ do something } Directory: If (Test-Path <path> -Container){ do something }
#PowershellTip: Tired of creating or overwriting csv output files to fix your formatting? Use Out-Gridview instead for a nice GUI display of how your csv file will be formatted, and switch back to export-csv when finished.
If you are using PowerShell as your terminal in VSCode, you can pipe any output or variable to 'New-EditorFile'. 😎#powershelltip
----------#PowerShell Tip #2---------- Get-Help automatically adds the wildcard characters behind the scenes. In the example, the (*) wildcard characters are not required and omitting them produces the same result. #PowerShellTip #girlswhocode #100DaysOfCode #azure #Microsoft
@jpomfret I liked this one. I learned about using continue to exit the current step in a loop. Thanks for sharing your code. #PowerShellTip
Did you know the #PowerShell split method has a 'MaxSubString' parameter? If you specify .split('.',2) it'll split the string at the first two . and then stop #PowerShellTip
#PowerShellTip #PowerShell one liner Get previous month last date ([DateTime]::Today.AddDays(- ([datetime]::Today.Day))).ToLongDateString()
Did you know that you can assign multiple variables via the Split operator (and string method)? #PowerShell #PowerShellTip
#PowerShellTip to render HTML on browser using #Polaris module! Working on own middleware template.... Try it yourself! github.com/PowerShell/Pol…
#PowerShellTip To retrieve last 5 values from the given #PowerShell array # Array has value positioned 0 to 9 $array = 1..10 # Using range operators with (-) we read values right to left! Positions [-1 = 10 and -5 = 6] $array[-1..-5]
#PowerShellTip to zoom in ISE or VS Code by sendkeys class and sendwaitmethod() ^ is 'CTRL' and {ADD} is '+' Zoom by 5% 😉
#PowerShellTip to find methods overload definitions [math]::abs
#PowerShellTip get odd numbers in oneliner.... (1..10).where({$_ % 2})
