With one small adjustment, the script in my previous post can be used as a function to list all properties and subproperties of any variable in Windows Powershell. It’s a great way to explore Powershell and create scripts. I used to do the following procedure very often:
$a = Get-Process #For [...]
UPDATE: Fixed the script to also recurse through arrays. It only gets the first item in the array. That’s for a good reason. Else you’ll get millions of items!
Wow! This was quite a challenge. But I did it!
Inspired by my scripts Create a Directory Tree with Powershell and Listing AD [...]
If you have been trying out the VMware VI Toolkit for Windows Powershell, you have probably noticed. You have to disconnect (disconnect-viserver) each session you set up to the VI Server (connect-viserver), or it will linger for eternity (or until the next reboot at least). That’s why I always [...]
I was playing around with PSDrives when I decided to write this script. It recurses through (part of) a PSDrive and shows the items it finds in a simple tree view.
The fun part is that it works on any PSDrive!
Show-Tree D:\scripts will show subdirectories and files in a tree; Show-Tree HKCU:\ will [...]
PeetersOnline.nl has been updated, restyled, pimped, tricked out… whatever you want to call it.
So, if you are following me via RSS, please come take a look at the new site design.
If you have any remarks or experience any issues, please leave a comment.
So much for visuals. Back to the scripting!
Check out this oneliner/function! Provide a computer name and it will return the logged on users.
function Get-MyLoggedOnUsers
{
param([string]$Computer)
Get-WmiObject Win32_LoggedOnUser -ComputerName $Computer | Select Antecedent -Unique | %{“{0}{1}” -f $_.Antecedent.ToString().Split(‘”‘)[1], $_.Antecedent.ToString().Split(‘”‘)[3]}
}
Hugo
The Quest Active Directory Cmdlets are very useful in getting AD group members. The only thing I was missing, was a -Recursive parameter. So I created this script.
You feed it AD Group Names as a parameter, and it will return a nice tree view of all members and subgroups and their members and so [...]
Of all the vSwitch properties, the Offload Policy settings are the most obscure. You can’t even view them through the GUI. You can see them in the /etc/vmware/esx.conf file, or using the Powershell VI Toolkit, if you know how to use this command:
((Get-VMHostNetwork ESXSERVER | Get-View).NetworkConfig.vSwitch | Where [...]
Now that you can list shares, how about something a bit more challenging?
Let’s take a look at share permissions. I tried using subinacl.exe to get these for a remote share. But it turns out that it does not always give trustworthy results. It showed read permissions for a share with Read and Change permissions. [...]
Here’s a handy little function I wrote for enumerating all shares on a remote server:
function Get-MyShares
{
param([string]$Server)
$Shares = Get-WmiObject -Class Win32_Share -ComputerName $Server
$output = @()
ForEach ($Share in $Shares)
{
$fullpath = “\\{0}\{1}” -f $server, $share.name
Add-Member -MemberType NoteProperty -InputObject $Share [...]
Tags
Active Directory API bind order cleanup cluster CPU Custom Fields datastores description device management directory tree errors Event Log file name filter Fun function HA IT known issues License Server LUN multipath NIC objects Oneliner portgroups PowerCLI PowerShell profile recursive Registry Scripts security session share snapshots SQL Stat VI Toolkit VMware vSphere WMI WSUS ZenArchives
- July 2012
- July 2011
- February 2011
- January 2011
- December 2010
- May 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
