I have script that is executable from another computer.
How to get comptername of location script? Just name, not full path (because the script can be distributed anywhere) Thanks
I have script that is executable from another computer.
How to get comptername of location script? Just name, not full path (because the script can be distributed anywhere) Thanks
Solved on my own. :-) Hope that helps someone.
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
[string[]]$sth = $scriptPath.Split('\',[System.StringSplitOptions]::RemoveEmptyEntries)
$servername = $sth[0]