https://github.com/raandree/230522powershellworkshop
https://github.com/raandree/230522powershellworkshop
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/raandree/230522powershellworkshop
- Owner: raandree
- License: mit
- Archived: true
- Created: 2023-05-24T08:25:21.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-24T11:33:06.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T13:09:08.615Z (7 months ago)
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 230522 PowerShel lWorkshop
## Notes
- Your PowerShell history is saved at this location and stores also clear text password :warning:.
```powershell
Get-Content -Path (Get-PSReadLineOption).HistorySavePath
```- Code Quality
For ensuring code quality refer to [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer)
- How to prevent from running code accidentally?
Put a `return` statement at the beginning or implement `WhatIf` feature.
- More info on how to write functions can be found here:
https://github.com/raandree/PowerShellTraining/blob/main/Functions/Readme.md
NTFSSecurity
dir -Recurse -Directory -Depth 1 | Get-NTFSInheritance | Where-Object { -not $_.AccessInheritanceEnabled } | Enable-NTFSAccessInheritance -RemoveExplicitAccessRules
-------------
return vs emitting values
function Add
{
param (
$i1,
$i2
)
$sum = $i1 + $i2
$i1
$i2
write-host "The sum is $sum"
$sum
}$data = Add -i1 5 -i2 7
--------------------