![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | RPC server unavailable Below is the error I am getting. I am getting the name of installed apps on remote machines. It works if I query my local machine. I have never needed to provide authentication for accessing WMI objects but do i need it for this particualr object? The variable $computername does hold an available computername I have already tested that. Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x80070 6BA) At C:\getcomputerlist.ps1:8 char:22 + $applications = gwmi <<<< Win32_product -computername '$computername' |
My System Specs![]() |
| | #2 (permalink) |
| | Re: RPC server unavailable put $computername variable in double quotes, not in single. If you set variable in single quotes PowerShell wil not expand variable. See examples: [vPodans] $computername = "computer" [vPodans] '$computername' $computername [vPodans] "$computername" computer you see, that variable is expanded only in double quotes. Enjoy! -- WBR, Vadims Podans PowerShell blog - www.sysadmins.lv "Jacob Sampson" <JacobSampson@xxxxxx> rakstīja ziņojumā "news:BFEC265D-4940-480A-A3A4-D7AE1AA3B42A@xxxxxx"... Quote: > Below is the error I am getting. I am getting the name of installed apps > on > remote machines. It works if I query my local machine. I have never > needed > to provide authentication for accessing WMI objects but do i need it for > this > particualr object? The variable $computername does hold an available > computername I have already tested that. > > Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: > 0x80070 > 6BA) > At C:\getcomputerlist.ps1:8 char:22 > + $applications = gwmi <<<< Win32_product -computername > '$computername' |
My System Specs![]() |
| | #3 (permalink) |
| | Re: RPC server unavailable Great that fixed it. It seems that there are instances where sometimes I have had to use single quote and sometimes double quotes to expand my variable am i not remembering correctly? Thanks for your help. "Vadims Podans" wrote: Quote: > put $computername variable in double quotes, not in single. If you set > variable in single quotes PowerShell wil not expand variable. See examples: > > [vPodans] $computername = "computer" > [vPodans] '$computername' > $computername > [vPodans] "$computername" > computer > > you see, that variable is expanded only in double quotes. > > Enjoy! > -- > WBR, Vadims Podans > PowerShell blog - www.sysadmins.lv > > "Jacob Sampson" <JacobSampson@xxxxxx> rakstīja ziņojumā > "news:BFEC265D-4940-480A-A3A4-D7AE1AA3B42A@xxxxxx"... Quote: > > Below is the error I am getting. I am getting the name of installed apps > > on > > remote machines. It works if I query my local machine. I have never > > needed > > to provide authentication for accessing WMI objects but do i need it for > > this > > particualr object? The variable $computername does hold an available > > computername I have already tested that. > > > > Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: > > 0x80070 > > 6BA) > > At C:\getcomputerlist.ps1:8 char:22 > > + $applications = gwmi <<<< Win32_product -computername > > '$computername' > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: RPC server unavailable You're right. In WMI queries you will frequently use double and single quotes compination. For example: gwmi win32_share -filter "name = '$name' " here variable is in single quotes. But here also are outer double quotes. Outer quotes determine will be expanded inner variables or not. See these examples: [vPodans] $computer = "variable" [vPodans] " '$computer' " 'variable' [vPodans] ' "$computer" ' "$computer" There is only one reason, why we should use single quotes inside double quotes - parameter value may contain spaces. Therefore we should put value into quotes to represent value with spaces as whole string. If you put value in double quotes (when you already have outer double quotes) you'll get quotes violation. Enjoy! -- WBR, Vadims Podans PowerShell blog - www.sysadmins.lv "Jacob Sampson" <JacobSampson@xxxxxx> rakstīja ziņojumā "news:13860132-4470-454F-9F32-93F4B5DEA4EC@xxxxxx"... Quote: > Great that fixed it. It seems that there are instances where sometimes I > have had to use single quote and sometimes double quotes to expand my > variable am i not remembering correctly? > > Thanks for your help. > > "Vadims Podans" wrote: > Quote: >> put $computername variable in double quotes, not in single. If you set >> variable in single quotes PowerShell wil not expand variable. See >> examples: >> >> [vPodans] $computername = "computer" >> [vPodans] '$computername' >> $computername >> [vPodans] "$computername" >> computer >> >> you see, that variable is expanded only in double quotes. >> >> Enjoy! >> -- >> WBR, Vadims Podans >> PowerShell blog - www.sysadmins.lv >> >> "Jacob Sampson" <JacobSampson@xxxxxx> rakstīja >> ziņojumā >> "news:BFEC265D-4940-480A-A3A4-D7AE1AA3B42A@xxxxxx"... Quote: >> > Below is the error I am getting. I am getting the name of installed >> > apps >> > on >> > remote machines. It works if I query my local machine. I have never >> > needed >> > to provide authentication for accessing WMI objects but do i need it >> > for >> > this >> > particualr object? The variable $computername does hold an available >> > computername I have already tested that. >> > >> > Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: >> > 0x80070 >> > 6BA) >> > At C:\getcomputerlist.ps1:8 char:22 >> > + $applications = gwmi <<<< Win32_product -computername >> > '$computername' >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| RPC server unavailable | Vista General | |||
| The RPC server is unavailable | PowerShell | |||
| RPC Server is unavailable | Vista networking & sharing | |||
| RPC Server is unavailable | Vista General | |||
| The RPC server is unavailable. | Vista General | |||