嗨,我是新來的電源外殼,我不能似乎得到這個腳本來運行它是使用命令提示符在這裏工作組中的計算機上遠程執行命令的錯誤我得到的腳本如下我是Win 7的機器上運行的腳本,我想遠程執行對機器的Windows XP SP3防火牆被關閉和COM設置爲默認的身份驗證設置設置並確定冒充和幫助將是巨大的PowerShell的錯誤WMI
這裏是錯誤 Invoke-WmiMethod:訪問被拒絕。 (從HRESULT異常:0X80070005(E_ACCESSDENIED)) 在C:\用戶\凱文\文件\ WindowsPowerShell \ Microsoft.PowerShell_profile.ps1:57字符:40 + $的NewProc =調用-WmiMethod < < < < -class Win32_Process的-name創建` + CategoryInfo:NotSpecified:(:) [調用-WmiMethod],UnauthorizedAccessException + FullyQualifiedErrorId信息:System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.InvokeWmiMethod
$command = Read-Host " Enter command to run"
$user = "\Administrator"
$Domainname = $HostName +$user
$login = Get-Credential $domainname
[string]$cmd = "CMD.EXE /C " +$command
}
process {
$newproc = Invoke-WmiMethod -class Win32_process -name Create `
-ArgumentList ($cmd) -EnableAllPrivileges -ComputerName $HostName -authentication Packetprivacy -Impersonation 3 -Credential $login
if ($newproc.ReturnValue -eq 0)
{ Write-host -foregroundcolor Green "Command $($command) Ran Sucessfully on $($HostName)"}