Got this email from someone who was reluctant to send it to the list.
As a result, you can't use the code attached in the project - but I
don't think it's usable as is -- but I have to say that. But it gives a
good example of how one can use Powershell to do discovery-like things.
I don't think the execution policy mentioned is a problem for our
situation (locally-resident scripts) (but I've been wrong before).
---------------------------------------------------------------
Have you fiddled with Windows Powershell at all? It looks to be
a reasonably robust scripting environment (beats the hell out of
.BAT files, anyway). From what I've read, it's closely associated
with the C# environment and can see interesting stuff inside the
OS.
You have to do a one-time security setting change in order to
write and run scripts, because the script execution policy is
set to Restricted by default:
set-executionpolicy RemoteSigned -scope currentuser
This change is persistent across Powershell sessions; I think it's
a registry setting. You could set it to 'unrestricted', and some
tutorials advise that, but 'RemoteSigned' is a little more sensible.
Anyway - the point is that it might be possible to do some interesting
and useful stuff with Powershell scripting, and since it's just scripts
you wouldn't have to muck around with C# compilation. Attached is an
utterly trivial Powershell script that shows your IP address and some
other stuff about the machine environment.
<#
.SYNOPSIS
This is a trivial script written by a trained lemur
.DESCRIPTION
This script illustrates some basic stuff like how to
get the IP address of your system, etc.
#>
write-host "Hello, world!"
$greeting = "Hola"
$name = "amigo"
$salutation = "$greeting" + ", " + "$name" + "!"
write-host "$salutation"
# single-line comment starts with #
# $name = read-host "What is your name?"
# "$greeting, $name!"
$IPADDR = ((Test-Connection $env:computername -Count
1).ipv4address).ipaddresstostring
write-host "Wow! Your IP address is $IPADDR"
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE
-ComputerName $env:computername
_______________________________________________
Assimilation mailing list - Discovery-Driven Monitoring
[email protected]
http://lists.community.tummy.com/cgi-bin/mailman/listinfo/assimilation
http://assimmon.org/