Restart Service on Remote Computer with PowerShell

If you search for “PowerShell Restart Service Remote Computer”, the challenge is a lot of the top results will be for earlier versions of PowerShell and a lot more complicated than needed. For some reason, Microsoft doesn’t just give the Restart-Service command a -ComputerName switch…I guess that would be too intuitive.   After some digging, I found it’s still easy, you just need to Get-Service first.  Below is an example of restarting BITS.  I used a wildcard just to show you that wildcards work.  Run this from an elevated PowerShell prompt and replace <COMPUTERNAME> with the name of your computers.

Get-Service -Name BIT* -ComputerName  | Restart-Service

This works great for restarting a service on a few remote computers.  If you need to restart a service for all the computers in your domain, here’s a script to help with that process.  This script does need to be run from an AD server as it requires Get-ADComputer or you’ll need to install the PS module on the server where you’ll be running this script.   The value on this is it pulls out all the active computers and restarts you’re selected service.  This helped us on an issue where our remote access software ScreenConnect started dropping out of our console.  A bug in their keep alives is causing the issue and the temp fix is to restart the service…but sometimes it’s hard to remember what’s missing so this goes through all computers active in your domain and restarts the service.

$today = Get-Date
$cutoffdate = $today.AddDays(-15)

Get-ADComputer  -Properties * -Filter {LastLogonDate -gt $cutoffdate}|Select -Expand DNSHostName  | out-file C:\All-Computers.txt

$computers = get-content "C:\All-Computers.txt"
$amount = $computers.count

foreach ($computer in $computers)
   Invoke-Command -ComputerName $computer { Restart-Service -Name 'ScreenConnect Client (f95335af7be34c6f)' } -ErrorAction SilentlyContinue Write-Progress -Activity "Working..." -CurrentOperation "$a Complete of $amount" -Status "Please wait.  Restarting service."


Can’t Change Display Brightness on Windows 10

If after upgrading to Windows 10 you can’t change your display brightness (the option may be missing in Settings/Display), this may be your fix.

  1. Right-Click the Start button and select Device Manager
  2. Expand the Monitors section
  3. Right-click on Generic PnP Monitor and click on Enable

After fighting to find the latest video drivers (HP hasn’t re990leased Win 10 drivers for my Pavilion), this fixed my issue.

Windows 10 Fix for Remote Gateway VPN Bug

When connected to a vpn, we often want to continue to use our connection for Internet traffic rather than forwarding it through the tunnel.  With Win 10, there’s a bug that prevents us from clicking on the Properties button for TCP/IP v4. David Carroll posted a fix here .  Other posts give fixes of editing the RAS phonebook, but David’s PowerShell method is much easier to me.  I’m posting the steps here as well (mostly for my records).  One key, I’ve noticed that if you have a space in the name of your VPN the Get-VpnConnection won’t return your connection info.  So if you have a connection like “VPN 1”, this method wouldn’t work for me but if you name it “VPN1” it works fine.

  1. From PowerShell, type Get-VpnConnection while connected to your VPN.  You’ll notice that the SplitTunneling is set to False.
  2. Set-VpnConnection “VPN1” -SplitTunneling 1 (replace VPN1 with the name of your VPN returned from the Get-VpnConnection.
  3. Disconnect from your VPN session and reconnect.  
  4. In Bing or Google, just type “what is my ip” and you should have your local internet IP rather than the one going through the VPN.

That should do it.

SQL Azure Table Size

I’ve been fighting with a DotNetNuke install hosted on Azure for a while. We’ve been testing as there’s a lot we like about Azure but the performance when editing DotNetNuke has caused us to go a different route…but that’s another story.  In our test site, the SQL database size just kept growing.  To find out the culprit, I wanted to know the size of each table.  This post from Alexandre Brisebois did just what I needed.  My only tweak was to Order By the size.

SELECT AS [table_name],
sum(p.reserved_page_count) * 8.0 / 1024 / 1024 AS [size_in_gb],
p.row_count AS [records]
sys.dm_db_partition_stats AS p,
sys.objects AS o
p.object_id = o.object_id
AND o.is_ms_shipped = 0

GROUP BY , p.row_count
ORDER BY size_in_gb DESC

For me, it was pretty clear that I needed to truncate the DotNetNuke EventLog and ScheduleHistory.  In production, you would want to schedule this as it’s amazing how quickly these can grow.  We hadn’t put this site into production yet but the EventLog was 20 GB after just a few months.

truncate table EventLog
truncate table ScheduleHistory

This may or may not be related to anything you need, but for me in this SQL Azure situation, I noticed that even though I had truncated about 20 GB’s of data the Azure Dashboard didn’t reflect that.  Digging around it seems to be related to my indexes being fragmented.  So, following Dilkush Patel’s post I ran this query to see my fragmentation. (Note: I did make a minor change to Order By the % of fragmentation.

,OBJECT_NAME(ps.object_id) AS TableName
, AS IndexName
FROM sys.dm_db_partition_stats ps
INNER JOIN sys.indexes i
ON ps.object_id = i.object_id
AND ps.index_id = i.index_id
CROSS APPLY sys.dm_db_index_physical_stats(DB_ID(), ps.object_id, ps.index_id, null, 'LIMITED') ips
ORDER BY ips.avg_fragmentation_in_percent desc, ps.object_id, ps.index_id

For me, I had several tables over 60% fragmented.  So I ran Dilkush’s script:

DECLARE @TableName varchar(255)

SELECT '[' + IST.TABLE_SCHEMA + '].[' + IST.TABLE_NAME + ']' AS [TableName]

OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName

PRINT('Rebuilding Indexes on ' + @TableName)
Begin Try
End Try
Begin Catch
PRINT('Cannot do rebuild with Online=On option, taking table ' + @TableName+' down to rebuild')
End Catch
FETCH NEXT FROM TableCursor INTO @TableName

CLOSE TableCursor

However, after running this (several times in fact) the usage in my Azure Dashboard has not changed.  I’ll wait and see if it changes and update this post if it does.

Azure database ‘xxx’ has reached its size quota

I keep bumping in to this issue so I thought I’d post my steps to resolution. When you create an Azure SQL database, it sets a size limit for the database. When the database fills up, you’ll get an error like this:

The database ‘XXX’ has reached its size quota. Partition or delete data, drop indexes, or consult the documentation for possible resolutions.

The fix requires 2 steps: First you need to increase the database size in the Azure portal but then secondly you need to alter your database in SQL.

  1. Login to the Azure Management Portal and go to your SQL Database.
  2. On the Dashboard tab, you should see that the size of your database is 100% of your total in the Usage Overview.
  3. Click on the Scale tab and change the Max Size and click Save.


That fixes the Azure max size limit, but now we need to update our SQL database itself.

  1. Fire up SQL Management Studio and connect to your Azure SQL Server.
  2. On your database, open a New Query.
  3. Run this query replacing YOURDATABASE with the name of your database in both locations.


  1. This shows you your Azure Database Edition and your current Max Size.  Now go run this query on the MASTER database changing the Database Name, Edition and Maxsize values as needed.


Hit refresh on your site and it should now come up without error.

SQL Server Migration Assistant for Access nightmare

Getting from Access to SQL is not as much fun as it should be and it seems that it gets harder with each release. The upsize tool in Access 2013 is gone and the recommended way is now to use the SQL Server Migration Assistant (SSMA).

Like a lot of people, I run Windows 64-bit OS with 32-bit Office (which is Microsoft’s recommendation. When running SSMA, I kept hitting the following error:

Access Object Collector error: Database

     Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 80040154. This error may be a result of running SSMA as 64-bit application while having only 32-bit connectivity components installed or vice versa. You can run 32-bit SSMA application if you have 32-bit connectivity components or 64-bit SSMA application if you have 64-bit connectivity components, shortcut to both 32-bit and 64-bit SSMA can be found under the Programs menu. You can also consider updating your connectivity components from

     An error occurred while loading database content.

Based on this post, I’d regsvr32 Da0360.dll and added that folder to my environment’s PATH but neither helped.  For others, running the 32-bit version of SSMA was the suggested fix but this also didn’t work for me.  I almost went down the path of setting corflags but just didn’t feel that that was my issue.

Thinking it was all about 32bit and 64bit, I pulled out my tablet which is Win 8.1 32-bit but it had the exact same error.  Finally, I found this post which had the fix which is to install the Microsoft Access Database Engine 2010 Redistributable.  The post used the 2007 edition but I used 2010 and it worked fine.  I think it may work with Microsoft Access Database Engine 2013 but once it worked with the 2010 edition, I moved on.  I’m not sure why having Access 2013 isn’t enough but I know a lot of other people are struggling with this issue and not getting much support from the SSMA team.  In fact, support for that product seems really lacking.  On the SSMA 5.2 version page (5.3 is out and the one I installed) there were several comments (some very frustrated) with my exact issue but no response from the Microsoft team.  I emailed their help address which replied with an auto-response to open a ticket which I did, but still no response.  Hopefully this post will help someone and you won’t feel so alone.  🙂

DPM 2012 fails to backup SQL 2012 database

Our SQL 2008 backups were working just fine with Data Protection Manager 2012 until we upgraded SQL to SQL 2012.  Then we started getting the error:

The DPM job failed for SQL Server 2012 database <SQL database> on <our sql server> because the protection agent did not have sysadmin privileges on the SQL Server instance. (ID 33424 Details: )

The suggestion is to add “‘NT Service\DPMRA\ to the sysadmin role on the SQL Server instance.” That’s very specific so that must be the fix.  The problem is I don’t have an ‘NT Service\DPMRA’ user in Windows or SQL.  Here’s the fix:

  1. In SQL Management Studio, connect to the SQL 2012 Server and then expand Security.
  2. Expand Logins and right click on NT AUTHORITY\SYSTEM and select Properties.
  3. Click Server Roles, check sysadmin and click OK.

I read a post saying you could also add NT Service\DPMA like the Recommended Action in DPM states, but I don’t have that as a SQL Logins and wasn’t able to find it as a Windows account to create one.

Once I added sysadmin to the Server Roles, I was able to right click and “Perform Consistency Check…” and everything took off.  You may also go to the jobs themselves and click “Run configuration protection job again”.

Note, for me the Consistency Checks failed on some but this time with a new (more common) error saying “Recovery point creation failed”.  The fix was simply to create a new Recovery Point.

Server 2012 GPO–Hide These Specified Drives

Prior to Server 2012, if you wanted to hide certain drives through GPO you’d edit User ConfigurationPoliciesAdministrative TemplatesWindows Components, and Windows Explorer changing the GPO Hide the specified drives in My Computer as stated in MS KB 231289.

After upgrading our domain to Windows Server 2012, I could not find that setting.  Turns out the Windows Explorer has been renamed to File Explorer  in the GPO. There you’ll find your settings.   🙂

That being said, it’s sort of an old policy and only hides certain drives.  So you may need this blog post to hide other drives.

Setting NTP Time on ProCurve 3500yl

This is probably true for most of the ProCurve line but since I’ve only performed this on a 3500yl and want make any statements other than “I assume it’ll work on most ProCurve switches”.   Here’s the steps to set the switch to get it’s time from an NTP server such as

  • Telnet into your switch.
  • Type Menu <Enter>
  • System Information <Enter>
  • Edit <Enter>
  • Arrow down to Time Sync Method and hit <Space> until it’s set to SNTP.
  • Arrow down one to SNTP Mode and hit <Space> until it’s set to Unicast and hit <Enter>.
  • Arrow to Server Address and enter the address of your NTP server and hit <Enter> (Note: For me I use the ip for Since the switch doesn’t offer DNS settings, we put the IP and just hope it doesn’t change…which it does from time to time. If we have a local NTP server, we use this IP)
  • Move to Save and hit <Enter>

If your switch has access to the NTP server, it updated the time immediately for me which you’ll see in the top right of your Switch Configuration Menu.

While your here, you probably also want to set the timezone which is an offset in minutes from GMT.  For example, EST is -5 hours from GMT so you’d enter -300 and save.

Filtering “Assigned To” field in TFS 2010

CodingWhen you select the Assigned To drop down in a TFS work item, you’ll often see a lot of system accounts that you don’t want.  Nikos’ post on TFS 2008 still works for TFS 2010 with the Power Tools.  Previously, I was exporting the XML, editing it, and then re-imported based on Edward Smit’s post and several other forums but once I found Nikos’ post I’ve started just updating it direct with the Power Tools.  I wanted to filter by the Project Administrators and Contributors groups.

I also wanted the ability to “unassign” a task after it had been assigned to a user.   If there’s an easy way to set a work item back “nothing” for the assigned user after it’s been assigned, I don’t know it.  But this is an easy work around.  Create a user called Unassigned and then we just set it to that when we want to let them team know it’s currently unassigned. Here’s the steps…

  1. In VS 2010, click ToolsProcess EditorWork Item Types, and Open WIT from Server. (assumes you’ve install TFS Power Tool)
  2. Select the Work Item Type you want to edit for your Team Project.
  3. Double click the row for Assigned To.
  4. Click the Rules tab.
  5. Select VALIDUSER and click Delete (if you don’t do this you want see users that aren’t valid like our Unassigned user)
  6. Click New and select ALLOWEDVALUES and click OK
  7. On ALLOWEDVALUES, leave For and Not blank.  Click New and enter each of these:
    • [Project]\Contributors
    • [Project]\Project Administrators
    • Unassigned

  1. Click OK

  1. Click OK again.

That should do it.  Refresh you Team Project and now open the work item of the type you edited and the Assigned Toshould be filtered now and should include the option to set it Unassigned.