Hey all,
I'm new to this forum, PowerShell and the .NET Framework. All of my previous work had me using Linux, Apache, MySQL and PHP--all the good, free stuff of the world.
I'm writing a simple library of scripts at work that will occasionally poll a couple of subnets in our office for certian tidbits of basic information. The info we'll be looking for is stuff like the following:
- Applications installed
- Printers installed
- Service Tag Numbers
And so on.
Most of the information we need to gather can be accessed through Windows Management Interface (WMI) Objects. The occasional piece of info needs to be retrieved from the registry of a remote computer.
I found the below lines of code on the web; they accomplish this task of reading the values of remote keys and have gotten them to work in our program:
$strMachineName = 'MURBAMEXV004'
$objReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $strMachineName)
$objRegKey= $objReg.OpenSubKey("SOFTWARE\\MQUEST\\ScriptEngine\\Program" )
$objRegKey.GetValue("PrimaryScriptServer")
My question is--where does this funky syntax come from, this [object.subobject.attribute]::method('arguments') stuff?
Does this come from C# or VBScript or is it merely a standard way to write scripts that play with .NET objects and methods?