如何使用PowerShell修改Host文件

下面的命令, 为Host文件添加了一条记录, 让/sps2010/hostheader1/这个url指向server自己.

$url=”http://sps2010/hostheader1/”

if( (Get-Content $env:windir\System32\drivers\etc\hosts |?{$_ -imatch "\s$url"}) -eq $null){"`n127.0.0.1 $url" | Out-File -FilePath "$env:windir\System32\drivers\etc\hosts" -Append -encoding ascii}

 

参考资料

===============

SharePoint 2010 for Hosters Whitepaper

posted on 2012-01-26 09:12  中道学友  阅读(2046)  评论(0编辑  收藏  举报

导航

技术追求准确,态度积极向上