Update README.md

This commit is contained in:
Alex Kup 2023-05-05 00:57:50 +03:00 committed by GitHub
parent b11b9ce031
commit 3a0117651d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2107,7 +2107,7 @@ $Excel.Quit()
`$Chart = New-ExcelChartDefinition -XRange CPU -YRange WS -Title "Process" -NoLegend` \ `$Chart = New-ExcelChartDefinition -XRange CPU -YRange WS -Title "Process" -NoLegend` \
`$data | Export-Excel .\ps.xlsx -AutoNameRange -ExcelChartDefinition $Chart -Show` `$data | Export-Excel .\ps.xlsx -AutoNameRange -ExcelChartDefinition $Chart -Show`
# XML (Extensible Markup Language) # XML
``` ```
$xml = [xml](Get-Content $home\desktop\test.rdg) # прочитать содержимое XML-файла $xml = [xml](Get-Content $home\desktop\test.rdg) # прочитать содержимое XML-файла
$xml.load("$home\desktop\test.rdg") # открыть файл $xml.load("$home\desktop\test.rdg") # открыть файл
@ -2133,7 +2133,7 @@ return
} }
} }
``` ```
### XmlWriter ### XmlWriter (Extensible Markup Language)
``` ```
$XmlWriterSettings = New-Object System.Xml.XmlWriterSettings $XmlWriterSettings = New-Object System.Xml.XmlWriterSettings
$XmlWriterSettings.Indent = $true # включить отступы $XmlWriterSettings.Indent = $true # включить отступы
@ -2186,8 +2186,6 @@ $log = '
} }
}' | ConvertFrom-Json }' | ConvertFrom-Json
``` ```
`Invoke-RestMethod -Uri "https://jsonplaceholder.typicode.com/posts" -Method Get` GET-запрос для получения объекта JSON
### YAML (Yet Another Markup Language) ### YAML (Yet Another Markup Language)
``` ```
Import-Module PSYaml Import-Module PSYaml
@ -2209,9 +2207,13 @@ $Result.Values.ethernets.ens160.nameservers
### HTML (HyperText Markup Language) ### HTML (HyperText Markup Language)
`Get-Process | select Name, CPU | ConvertTo-HTML -As Table > "$home\desktop\proc-table.html"` вывод в формате List (Format-List) или Table (Format-Table) `Get-Process | select Name, CPU | ConvertTo-HTML -As Table > "$home\desktop\proc-table.html"` вывод в формате List (Format-List) или Table (Format-Table)
`Import-Module PSWriteHTML` \ ### PSWriteHTML
`(Get-Module PSWriteHTML).ExportedCommands` \ ```
`Get-Service | Out-GridHtml -FilePath ~\Desktop\Get-Service-Out-GridHtml.html` Import-Module PSWriteHTML
(Get-Module PSWriteHTML).ExportedCommands
Get-Service | Out-GridHtml -FilePath ~\Desktop\Get-Service-Out-GridHtml.html
```
### HtmlReport
``` ```
Import-Module HtmlReport Import-Module HtmlReport
$topVM = ps | Sort PrivateMemorySize -Descending | Select -First 10 | %{,@(($_.ProcessName + " " + $_.Id), $_.PrivateMemorySize)} $topVM = ps | Sort PrivateMemorySize -Descending | Select -First 10 | %{,@(($_.ProcessName + " " + $_.Id), $_.PrivateMemorySize)}
@ -2225,13 +2227,13 @@ ps | Select ProcessName, Id, CPU, WorkingSet, *MemorySize | New-Table "All Proce
### CSV (Comma-Separated Values) ### CSV (Comma-Separated Values)
`Get-Service | Select Name,DisplayName,Status,StartType | Export-Csv -path "$home\Desktop\Get-Service.csv" -Append -Encoding Default` экспортировать в csv (-Encoding UTF8) \ `Get-Service | Select Name,DisplayName,Status,StartType | Export-Csv -path "$home\Desktop\Get-Service.csv" -Append -Encoding Default` экспортировать в csv (-Encoding UTF8) \
`Import-Csv "$home\Desktop\Get-Service.csv" -Delimiter ","` импортировать массив `Import-Csv "$home\Desktop\Get-Service.csv" -Delimiter ","` импортировать массив
```
`$data = ConvertFrom-Csv @"` \ $data = ConvertFrom-Csv @"
`Region,State,Units,Price` \ Region,State,Units,Price
`West,Texas,927,923.71` \ West,Texas,927,923.71
`$null,Tennessee,466,770.67` \ $null,Tennessee,466,770.67
`"@` "@
```
# SQLite # SQLite
`Install-Module MySQLite -Repository PSGallery` \ `Install-Module MySQLite -Repository PSGallery` \