2015年(5)
分类: 系统运维
2015-07-02 09:17:07
Function TestWebSitesLoadTime()
{
$URLList = "
ForEach($url in $URLList){
$ie = New-Object -COM InternetExplorer.Application
$ie.Navigate($url)
$ie.Visible = $true
$timeTaken = 0
while ($ie.Busy -eq $true) {
Start-Sleep -Milliseconds 500;
$timeTaken = $timeTaken + 0.5
}
$context = " This $url took $timeTaken s to execute"
$Date = get-date
$timeTage = "----------------------------$Date-----------------------------"
Logwrite -LogFile C:\test\websiteloadtime-Proxy.txt -LogString $timeTage
Logwrite -LogFile C:\test\websiteloadtime-Proxy.txt -LogString $context
Logwrite -LogFile C:\test\websiteloadtime-proxy.txt -LogString "-----------------------------------------"
}
get-process iexplore | stop-process
}
也可以把所需测试网站地址放到某一个文件中,最终最为参数传递给函数执行,只需维护网站地址即可.
仅供娱乐.