PowerShell Arrays Introduction
In this video we talk about PowerShell Arrays and how I use them with new-object to create CSV files of data that I can work with in a familiar way. Also covered are hashtables and few other tricks.
For support, training, or more information about PowerShell check out http://www.boldzebras.com
Here is the actual PowerShell from the video.
$Array = @()
$Processes = Get-Process
Foreach($Proc in $Processes)
{
If($Proc.WS/1mb -gt 100)
{
$Array += New-Object psobject -Property @{'ProcessName' = $Proc.name; 'WorkingSet' = $Proc.ws}
}
}
$Array | select 'ProcessName', 'WorkingSet' | Export-Csv .\file2.csv -NoTypeInformation
$CSVImport = @()
$CSVImport = Import-Csv .\file2.csv
ForEach($dog in $CSVImport){Write-host "Process Name:" $dog.processname " Working Set:" $dog.workingset}
#Just want to look at it in a prettier way?
$CSVImport | Format-Table -AutoSize
#Other tricks to keep in your pocket
$CSVImport[1].ProcessName
Видео PowerShell Arrays Introduction канала Shane Young
For support, training, or more information about PowerShell check out http://www.boldzebras.com
Here is the actual PowerShell from the video.
$Array = @()
$Processes = Get-Process
Foreach($Proc in $Processes)
{
If($Proc.WS/1mb -gt 100)
{
$Array += New-Object psobject -Property @{'ProcessName' = $Proc.name; 'WorkingSet' = $Proc.ws}
}
}
$Array | select 'ProcessName', 'WorkingSet' | Export-Csv .\file2.csv -NoTypeInformation
$CSVImport = @()
$CSVImport = Import-Csv .\file2.csv
ForEach($dog in $CSVImport){Write-host "Process Name:" $dog.processname " Working Set:" $dog.workingset}
#Just want to look at it in a prettier way?
$CSVImport | Format-Table -AutoSize
#Other tricks to keep in your pocket
$CSVImport[1].ProcessName
Видео PowerShell Arrays Introduction канала Shane Young
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
PowerShell ForEach-ObjectPowerShell String ManipulationMicrosoft PowerShell for Beginners - Video 1 Learn PowerShellLearn to securely use Passwords with PowerShellPowerShell Master Class - PowerShell FundamentalsAutomate your PowerShell scripts with Windows Task SchedulerPowerShell Array TutorialCopy, Move, Delete files with PowerShellIntro to PowerShell for SharePointManipulating Objects in Microsoft PowerShell - Video 2PowerShell Variables ExplainedShane Learns Power BI LiveMove SharePoint Online files with MetadataWork with Date & Time with PowerShellCreating AD Users from CSV with Powershell | ServerAcademy.comAdvanced Function Parameters in PowershellUsing PowerShell to work with SharePoint ListsIntroduction to PowerShell Module 3: LoopsYou Should Learn PowerShellUse the PowerShell Switch statement to replace Ifs