nemmi69
Well-known Member
- Joined
- Mar 15, 2012
- Messages
- 938
- Office Version
- 365
- 2019
- 2016
- 2013
- Platform
- Windows
I am running the following code to check if certain programs are running.
The error is "The RPC server is unavailable. <exception from="" hresult:="" 0x800706ba="">
On another PC that is doing exactly the same job this works without fault.
I know the IP is OK as I can open file explorer and using the IP see the shared directories. Also the IP is pingable. Checked with nslookup that the IP returns the correct host name and the host name returns the correct IP.
I have checked the firewall and it is OK
I have checked services.msc and made sure that the RPC WMI services are running.
I have checked the registry values I have checked Internet connection and its protocols</exception>
Have about run out of ideas
Code:
[COLOR=#242729][FONT=Consolas]##This Script is for checking status of 3 processes TestMgr.exe, iTestConsole.exe and tdefine.exe in all testBed machines[/FONT][/COLOR]
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">##Machine TestBed name and IP needs to be provided from a seperate text file TestBeds.txt. Should be put in same directory
#[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Output]#Output[/URL] would go to a CSV file testBedProcessReport.csv in the same directory
#[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=function]#function[/URL] assign is to assign status to various processes involved
function assign($process){
if($process -eq $null){return $creds}
elseif($process.count -eq $null){return "Running"}
else {return "cannot be determined"}
}
#[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=getting]#getting[/URL] data from external sheet with test bed and IP details
$allTestBeds = Get-Content \\gal71810.fs1.util.jlrint.com\powertrain\PT\PT-8\PT-83\PT-833\Shared\TestbedTools\Gaydon\ASAPMaster\Testbeds.txt
[psobject[]]$testBedStatus = ""
$all_process = ""
$creds = Get-Credential
#[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=looping]#looping[/URL] all test bed details to check process status
foreach($testBed in $allTestBeds){
$temp = $testBed -split "="
$testBedName = $temp[0] + ""
$computerIP = $temp[1]
$status = New-Object -TypeName psobject
Add-Member -InputObject $status -MemberType NoteProperty -Name TBName -Value $testBedName
Add-Member -InputObject $status -MemberType NoteProperty -Name TestMgr -Value "Running"
Add-Member -InputObject $status -MemberType NoteProperty -Name iTestConsole -Value "Running"
Add-Member -InputObject $status -MemberType NoteProperty -Name Tdefine -Value "Running"
#[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=getting]#getting[/URL] all process details by connecting to WMI service
$all_process = Get-WmiObject -Class Win32_Process -ComputerName $computerIP -Credential $creds
If($all_process -eq $null){
continue;
}
#[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Unique]#Unique[/URL] is used in case same exe is running many instances
$TestMgr = $all_process | where-object{$_.path -like "*TestMgr.exe*"} | select path -Unique
$status.TestMgr = assign($TestMgr)
$iTestConsole = $all_process | where-object{$_.path -like "*iTestConsole.exe*"} | select path -Unique
$status.iTestConsole = assign($iTestConsole)
$tdefine = $all_process | where-object{$_.path -like "*tdefine.exe*"} | select path -Unique
$status.tdefine = assign($tdefine)
$testBedStatus = $testBedStatus + $status
}
</code>[COLOR=#242729][FONT=Consolas]$testBedStatus | out-file \\gal71810.fs1.util.jlrint.com\powertrain\PT\PT-8\PT-83\PT-833\Shared\TestbedTools\Gaydon\ASAPMaster\TestBedStatus.csv[/FONT][/COLOR]
The error is "The RPC server is unavailable. <exception from="" hresult:="" 0x800706ba="">
On another PC that is doing exactly the same job this works without fault.
I know the IP is OK as I can open file explorer and using the IP see the shared directories. Also the IP is pingable. Checked with nslookup that the IP returns the correct host name and the host name returns the correct IP.
I have checked the firewall and it is OK
I have checked services.msc and made sure that the RPC WMI services are running.
I have checked the registry values I have checked Internet connection and its protocols</exception>
Have about run out of ideas