# Can you restart SQL Server Reporting Services using Powershell?

**URL:** <https://forums.powershell.org/t/can-you-restart-sql-server-reporting-services-using-powershell/13373>\
**Category:** PowerShell Help\
**Created:** [November 5, 2019, 10:12am UTC](https://forums.powershell.org/t/can-you-restart-sql-server-reporting-services-using-powershell/13373 "2019-11-05T10:12:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoe](https://avatars.discourse-cdn.com/v4/letter/z/a4c791/32.png) [@zoe](https://forums.powershell.org/u/zoe)\
**Post date:** [November 5, 2019, 10:12am UTC](https://forums.powershell.org/t/can-you-restart-sql-server-reporting-services-using-powershell/13373/1 "2019-11-05T10:12:15Z")

</div>

Hi!

I’m new to powershell but trying to learn. I need to restart a named instance of SSRS on a server. The instance is called POCSSRS

This is my code:

Get-Service -Computer $ssrs.machinename -Name “POCSSRS” | Restart-Service;

But I get the error:

**Get-Service : Cannot validate argument on parameter ‘ComputerName’. The argument is null or empty. Provide an**  **argument that is not null or empty, and then try the command again.**

&nbsp;

Any idea what Im doing wrong?

Thanks,

Zoe

&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [November 5, 2019, 10:13am UTC](https://forums.powershell.org/t/can-you-restart-sql-server-reporting-services-using-powershell/13373/2 "2019-11-05T10:13:38Z")

</div>

It looks like the property “machinename” on the $SSRS object is null or empty. If you output $SSRS.MachineName, is the value a string?

If you look at $SSRS, are there any other properties that might be useful?

---

<div class="post-metadata">

**Author:** ![kpatnayakuni](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kpatnayakuni/32/19_2.png) [@kpatnayakuni](https://forums.powershell.org/u/kpatnayakuni)\
**Post date:** [November 6, 2019, 9:37am UTC](https://forums.powershell.org/t/can-you-restart-sql-server-reporting-services-using-powershell/13373/3 "2019-11-06T09:37:27Z")

</div>

Hi @Zoe79,

In your command, the parameter name is not `-Computer`, its `-ComputerName`.

Usually named SSRS instances are created with the service name as ‘ReportServer$InstanceName’.

so in your case, you can use the command below…

[pre]

Get-Service -ComputerName $ssrs.machinename -Name ‘ReportServer$POCSSRS’ | Restart-Service;

[/pre]

Thank you.

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [November 6, 2019, 10:03am UTC](https://forums.powershell.org/t/can-you-restart-sql-server-reporting-services-using-powershell/13373/4 "2019-11-06T10:03:46Z")

</div>

@Kiran

Powershell will actually work on portion parameter names as long as it’s non-ambiguous. For instance, you have Get-WMIObject that has -ComputerName and -Class, we can’t use -C because that it is ambiguous, but if you add a letter it will work:

```
gwmi -co . -cl Win32_OperatingSystem
```

Powershell is built for admins so it is not strict and does a lot of automatic look ups. -Co is basically a wildcard search -Co\* that resolves to -ComputerName. For instance, Powershell also does things like automatic Module import if you call a command and it’s not available. It’s all about making things simple.

---

<div class="post-metadata">

**Author:** ![kpatnayakuni](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kpatnayakuni/32/19_2.png) [@kpatnayakuni](https://forums.powershell.org/u/kpatnayakuni)\
**Post date:** [November 6, 2019, 10:29am UTC](https://forums.powershell.org/t/can-you-restart-sql-server-reporting-services-using-powershell/13373/5 "2019-11-06T10:29:40Z")

</div>

[quote quote=186799][@kiran](https://powershell.org/forums/users/kiran/)

Powershell will actually work on portion parameter names as long as it’s non-ambiguous. For instance, you have Get-WMIObject that has -ComputerName and -Class, we can’t use -C because that it is ambiguous, but if you add a letter it will work:

\<textarea class="ace\_text-input" style="opacity: 0; height: 17.6471px; width: 7.19608px; left: 45px; top: 0px;" spellcheck="false" wrap="off"\>\</textarea\>

1

2

gwmi -co . -cl Win32\_OperatingSystem

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Powershell is built for admins so it is not strict and does a lot of automatic look ups. -Co is basically a wildcard search -Co\* that resolves to -ComputerName. For instance, Powershell also does things like automatic Module import if you call a command and it's not available. It's all about making things simple.

[/quote]  
Okay, it’s something new to me. Noted.

Thank you.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:31pm UTC](https://forums.powershell.org/t/can-you-restart-sql-server-reporting-services-using-powershell/13373/6 "2024-05-16T20:31:39Z")

</div>

Closed on May 16, 2024, 8:31pm UTC


