Last active
December 11, 2020 04:55
-
-
Save billkindle/3970705468b38c5b2a12363dd54cbf9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-NetAccountInfo { | |
#obtain the data and do some minor cleanup | |
$data = net.exe accounts | |
$data = $data -replace '^[T].*','' | |
foreach ($line in $data) | |
{ | |
#split on double colon character | |
$line = $line -split '\:\s+' | |
#define properties | |
$properties = @{ | |
AccountSetting = $line[0] | |
Value = $line[1] | |
} | |
#output object | |
New-Object -TypeName psobject -Property $properties | |
} | |
} | |
Get-NetAccountInfo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment