I've created a PowerShell function (called Get-FileInUse
) that will parse our data server for a list of known files.
The function returns ($global:result
as array) which files are in use and by whom.
I'd like to host an internal website that shows (when accessing it or when pressing a button on the site) the output of this function. Say an internal website inusefiles.corp.com
. Don't bother about bindings and DNS records, I'll manage that.
I've followed a tutorial online (this one), but it's hard to understand what's going on.
These are my two questions:
- How do I add my script in the aspx.cs file? I would like to have the script run when loading the page. Placing it under
protected void Page_Load(object sender, EventArgs e)
seems logical to me. - My function returns a variable
$result
. How do I show it in eg. a text box?
Note: I don't have any experience with ASP.NET/Web Forms. PowerShell is no problem for me.