etherlord
13-09-2013, 12:49
Доброго времени суток всем.
Пытаюсь сделать скрипт, к-рый будет ссылаться на другой скрипт, и при проверки столкнулся с проблемой, что комп не запоминает функцию.
Есть функция, лежащая в одноименном файле:
Function PingAw($CompName) {
$ping = New-Object System.Net.NetworkInformation.Ping
try
{
$Reply = $ping.Send($CompName)
}
catch
{
Write-host "Для машины " $CompName "не удалось выполнить ping"
}
return $Reply.status
}
из консоли запуская этот файл, и потом пробую запустить ф-цию
PS D:\Scripts> .\PingAw.ps1
PS D:\Scripts> Try { PingAw("127.0.0.1") } catch { echo "You must run PingAw script first" }
You must run PingAw script first
Suggestion [3,General]: The command PingAw was not found, but does exist in the current location. Windows PowerShell doe
sn't load commands from the current location by default. If you trust this command, instead type ".\PingAw". See "get-he
lp about_Command_Precedence" for more details.
PS D:\Scripts>
Пытаюсь сделать скрипт, к-рый будет ссылаться на другой скрипт, и при проверки столкнулся с проблемой, что комп не запоминает функцию.
Есть функция, лежащая в одноименном файле:
Function PingAw($CompName) {
$ping = New-Object System.Net.NetworkInformation.Ping
try
{
$Reply = $ping.Send($CompName)
}
catch
{
Write-host "Для машины " $CompName "не удалось выполнить ping"
}
return $Reply.status
}
из консоли запуская этот файл, и потом пробую запустить ф-цию
PS D:\Scripts> .\PingAw.ps1
PS D:\Scripts> Try { PingAw("127.0.0.1") } catch { echo "You must run PingAw script first" }
You must run PingAw script first
Suggestion [3,General]: The command PingAw was not found, but does exist in the current location. Windows PowerShell doe
sn't load commands from the current location by default. If you trust this command, instead type ".\PingAw". See "get-he
lp about_Command_Precedence" for more details.
PS D:\Scripts>