Tags » Powershell-basics

Loading assemblies

PowerShell is .NET based but doesn’t load all available .NET assemblies when it starts.

Many people still use something like

::LoadWithPartialName(‘System.Windows.Forms’)

to load additional assemblies. This is a hang over from PowerShell v1 when there wasn’t another way to perform the load. 51 more words

Powershell Basics

New variables with the variable cmdlets

So you have some data in csv format:

column1 column2 column3 column4
——- ——- ——- ——-
a1 b1 c1 d1
a1 b2 c1 d1
a1 b3 c1 d1… 244 more words

Powershell Basics

Folder creation dates from WMI

A question on the powershell.org about finding the creation date of folders raises some interesting points

To find a folder’s creation date use:

Get-WmiObject -Class Win32_Directory -Filter “Drive=’C:’ AND Path = ‘\\users\\$user\\'” | select Name, @{N=’Creation date’; E={$_.ConvertToDateTime($_.CreationDate)}} 117 more words

PowerShell And WMI

Monitor Info

A question on the forum about combining information from 2 CIM classes produced this:

function Get-MonitorInfo {

param(
$computername = $env:COMPUTERNAME
)

$cs = New-CimSession -ComputerName $computername… 356 more words

PowerShell And WMI

Comparing lists

An interesting question on the forum regarding how you compare the contents of 2 collections. The question revolved around comparing the contents of the Machine property of… 592 more words

Powershell Basics

CSV file with [] in headers

With the PowerShell Summit registration deadline rapidly approaching I wanted to see how registrations were going. I can down load a CSV file from the event website that lists attendees. 594 more words

Powershell Basics

Scripting Game puzzle - - January 2016

Here’s how I’d solve the puzzle

function get-starttime {

param(



]$computername = $env:COMPUTERNAME
)

PROCESS {

foreach ($computer in $computername){
$props = @{
ComputerName = $computer… 837 more words

Powershell Basics