UNCLASSIFIED

Skip to content
Snippets Groups Projects
Commit db0d407c authored by Joshua Parsons's avatar Joshua Parsons
Browse files

gensite

parent 2cde5c67
No related merge requests found
Pipeline #112151 passed with stages
in 9 seconds
......@@ -30,7 +30,7 @@ Get-Command -verb format
Get-Service | Format-Table Name, Status
----
.Create custom column heading with file size in KBs
.Display the name of each item in the current directory
[source,powershell]
----
Get-ChildItem | Format-Table Name
......@@ -42,7 +42,7 @@ Source: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell
PowerShell shows only so much information by default. You will have to use _Format-Table_ to view all the object properties.
.View all Properties
.View all Running Services using Format-Table
[source,powershell]
----
Get-Service | Format-Table
......@@ -50,7 +50,7 @@ Get-Service | Format-Table
Since the output of the previous cmdlet is too much information to shrink it onto the terminal. We will use a different formatting cmdlet called _Format-List_
.View all Properties using Format-List
.View all Running Services using Format-List
[source,powershell]
----
Get-Service | Format-List
......@@ -433,7 +433,7 @@ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.managem
[source,powershell]
----
PS C:\> get-content -path .\user.txt
PS C:\> Get-Content -Path .\user.txt
Administrator
DefaultAccount
Guest
......@@ -452,9 +452,9 @@ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.managem
.Add-Content
[source,powershell]
----
PS C:\> $User = (get-localuser).name
PS C:\> $User = (Get-LocalUser).Name
PS C:\> add-content -path .\testfile.txt -value $User
PS C:\> Add-Content -Path .\testfile.txt -Value $User
----
.Add-Content Using Pipeline
......@@ -462,7 +462,7 @@ PS C:\> add-content -path .\testfile.txt -value $User
----
#Running this command on PowerShell 5 will result in an error when using the pipeline.
PS C:\> Get-Content -Path .\testfile.txt | Add-Content -path .\testfile.txt
PS C:\> Get-Content -Path .\testfile.txt | Add-Content -Path .\testfile.txt
PS C:\> Get-Content .\testfile.txt
Administrator
......@@ -489,6 +489,27 @@ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.managem
[source,powershell]
----
PS C:\> Set-Content -Path .\testfile.txt -Value (Get-LocalGroup).name
PS C:\> Get-Content -Path .\testfile.txt
Access Control Assistance Operators
Administrators
Backup Operators
Cryptographic Operators
Device Owners
Distributed COM Users
Event Log Readers
Guests
Hyper-V Administrators
IIS_IUSRS
Network Configuration Operators
Performance Log Users
Performance Monitor Users
Power Users
Remote Desktop Users
Remote Management Users
Replicator
System Managed Accounts Group
Users
----
=== Export-CSV
......@@ -512,7 +533,7 @@ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility
.Import-CSV
[source,powershell]
----
PS C:\> Import-Csv -path C:\users\student\Desktop\svchost.csv
PS C:\> Import-Csv -Path C:\users\student\Desktop\svchost.csv
----
==== Converting Logs into a Usable Format for a SIEM (Security Information and Event Management)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment