SharePoint Experts, Information Architects, Expert Witness

We provide consulting in a broad array of business and technology from architecture to design to deployment of global systems with a focus on surfacing data in the enterprise. Specialists in Microsoft, we are a premier provider of SharePoint Expertise (including 2016 and Office 365). We also provide Expert Witness/Legal Expert in eDiscovery, source discovery, patent infringement, piracy and more! We also have established SICG DLDS s.a. - our counterpart in Costa Rica that specializes in water systems (http://www.crwatersolutions.com) - Contact me direct: david_sterling@sterling-consulting.com or call 704-873-8846 x704.

Search This Blog

Saturday, November 10, 2018

ULS Logs Searching for the Correlation ID

Having forgotten about this myself, I am posting here. In many cases, there's instances where you want to scan across ULS in SharePoint for a single Correlation ID. Notepad/Notepad++ are not much help here since messages are mixed. The ULS Viewer isn't always the best either.

The proper way to help you narrow down what you are looking for is "Merge-SPLogFile". This little gem searches across the ULS logs and helps you dump it into a single file.

Format is simple (obviously run one of the farm servers):

Merge-SPLogFile - Path <File Path> -Correlation <Correlation ID> -Overwrite

Overwrite is optional - it simply overwrites an existing file. So for example:

Merge-SPLogFile -Path "c:\temp\MyLogsMerged.log" -Correlation 7d88815d-17d5-412d-a71d-f0d124c8ad7c -Overwrite

And you can add the date (or time):

Merge-SPLogFile -Path "c:\temp\MyLogsMerged-$(Get-Date -f yyyy-MM-dd).log" -Correlation 7d88815d-17d5-412d-a71d-f0d124c8ad7c -Overwrite

Now you can use this merged log file in the ULS viewer so you can take your time to review an entire event without having to filter.

There are actually a lot of things you can use to filter - Correlation is just one. It can be an Event ID, service name, etc. - see the details here:

Merge-SPLogFile on docs.microsoft.com



Monday, November 5, 2018

Trouble adding a Custom Action in SharePoint 2016

Minor annoyances. I had this problem a while back and just haven't worked with it in a while so I figured I'd share.

When working with creating a Custom Action to add it to say the EditControlBlock, it's easy to make a common mistake. When you are adding it, you have to add it to the collection separately instead of directly on the list/library. So for example, this does not work (where DL is the Document Library to add to) - notice the bolded lines in each:

SPUserCustomAction TheCopyAction = DL.UserCustomActions.Add();
TheCopyAction.Title = "Copy to Extranet";
TheCopyAction.Sequence = 0;
TheCopyAction.Name = TheCopyAction.Id.ToString();
TheCopyAction.Url = "http://mdsp13sp2:83/hdtintra/eng/_layouts/15/copy.aspx?SourceUrl=http://mdsp13sp2:83{ItemUrl}&FldUrl=http://mdsp13sp2:83/eng/MyDocs/&Source=http://mdsp13sp2:83/hdtintra/eng/";
TheCopyAction.Location = "EditControlBLock";
TheCopyAction.Description = "Copy this file to the extranet site";
TheCopyAction.Update();

BUT, using the collection DOES work:

SPUserCustomActionCollection CustomActionCollection = DL.UserCustomActions;
SPUserCustomAction TheCopyAction = CustomActionCollection.Add();
TheCopyAction.Title = "Copy to Extranet";
TheCopyAction.Name = "Copy this file to the extranet site";
TheCopyAction.Sequence = 0;
TheCopyAction.Location = "EditControlBlock";
TheCopyAction.Url = "http://mdsp13sp2:83/hdtintra/eng/_layouts/15/copy.aspx?SourceUrl=http://mdsp13sp2:83{ItemUrl}&FldUrl=http://mdsp13sp2:83/eng/MyDocs/&Source=http://mdsp13sp2:83/hdtintra/eng/";
TheCopyAction.Update();

Oddly, you can see this in Designer - two added via C#, the first by the the top way and 2nd by the 2nd way:


Kudos to:
http://www.dotnetspark.com/kb/3773-diffrent-ways-to-deploy-custom-action-menu.aspx
(after spending 3 hours on this due to failure of memory, thanks!)


Saturday, September 8, 2018

Get the Public Key Token for a strongly named assembly in Visual Studio

So this is a rehash of an older post by Jeremiah Clark - original URL at the bottom of this post.

I have often needed to get the Public Key Token of a strong named assembly and have always done it by hand using sn.exe or the folder method. So the issue is how to get the Public Key Token easily - particularly when you need to create a Safe Control or otherwise add it to the web.config file. Of course, you can always build it, deploy to the GAC and find it in the c:\Windows\Microsoft.net\assembly folder under the appropriate folder:

GAC_32 = 32 bit
GAC_64 = 64 bit
GAC_MSIL = Any CPU

You'll find it there and the Public Key Token is part of the folder name. However, this is a pain - so this method turned out to work outstandingly well.

Step 1 - Find where sn.exe resides - where it is depends on which version of Visual Studio you are running. Open the Developer Command Window and type in:

where sn.exe

In my case, it found it under c:\Program Files (x86)\Microsoft SDKs\Windows\v10.0a\bin\NETFX 4.6.1 Tools\sn.exe:


Step 2 - Open Visual Studio, click Tools in the tool bar then select External Tools. When the pop up opens, click Add. Set the Title, Command and Arguments:

Title = Get SN Token
Command = c:\Program Files (x86)\Microsoft SDKs\Windows\v10.0a\bin\NETFX 4.6.1 Tools\sn.exe (the path to sn.exe)
Arguments = -T $(TargetPath)

Next, click the Checkbox to Use Output Window

This looks like this:

Click OK to save it.

Step 3 - Get the Public Key Token. When the project is opened (and you've built it at least once), just click Tools in the tool bar and select Get SN Token - this opens the output window as shown:


Done deal!

Jeremiah's original post





Monday, May 28, 2018

Remote Desktop Access (On-Premise & Azure) Error "CredSSP Encryption Oracle Remediation"

So, recent update in Microsoft has broken RDP across the globe. It's not necessarily a server problem, but many (unfortunately) allow for Automatic Update on their laptop/desktop and Microsoft added this update without any notice. When you try to RDP (Remote Desktop Connection), the error is "CredSSP Encryption Oracle Remediation" - The error will look similar to this:



So, if you are using servers on-premise, the only fix is to a) run update on all systems you intend to use RDP with (laptops, desktops, etc.) then b) run update on ALL of the servers you intend to connect to. A REAL pain, but the only way to fix it properly. I know the pain - I had to spend an entire weekend running updates (some 'packaged' which always makes me nervous in what is actually in it) and test every server.

Now, if you are using Azure, you will come across the same error - this one is a bit tricky but fortunately, a post on this shows the fix:

https://blogs.technet.microsoft.com/mckittrick/unable-to-rdp-to-virtual-machine-credssp-encryption-oracle-remediation/

Mitigation 1 was my choice - if you use this, after completing the change, open a command window as Administrator and run:

gpupdate /force

You need permissions to do this OR you have to talk to your system administrator(s) and get a global change.

Use Mitigation 2 ONLY if you have to!

UPDATE: Microsoft's May 2018 Security Update will fix this permanently however a reboot is required so plan accordingly - look for KB4103725 to download if it doesn't work with Windows Update (we had to try on a few servers several times - only accessible through the Hyper-V and VMWare consoles so were down for quite awhile; update would fail after 20 minutes or so).

Sunday, May 27, 2018

Start-SPAdminJob doesn't work

Old one but worth remembering - the Start-SPAdminJob doesn't work as you'd expect - entering the command by itself (and with -Verbose or any other options), you get an error (click the image to expand):


The fix is not really documented - you have to stop the SPAdmin (SharePoint Administration Services through Services.msc or PowerShell), run the cmdlet then start the service again. For 2013, it's:

Net Stop SPAdminV4
Start-SPAdminJob
Net Start SPAdminV4

Remember too that for now, stsadm -o execadmsvcjobs still works (use the Management Shell so you don't have to change directories).

ALWAYS USE Run as administrator when opening the Management Shell for best results!


Friday, March 23, 2018

Generate a detailed report about every document in your site collection SP13/16

Like many of you, I've searched for many a way to find out what's in the SharePoint site. I had a specific need to get a list of documents in the site collection and was not able to access my own so I came across a post that turned out to be 'almost' what I needed but was crude in what it did.

Thus this, the enhanced script to generate a detailed report about every document in your site collection. This is an excellent tool for integration with CRM or LOB systems!

NOTE: You have to modify the Reflection to update to 16. This one is for 13:

Download the Script here



Tuesday, February 27, 2018

Screen Timeout in Windows Server

If you are like me, doing development on servers can be a pain when the screen keeps locking. Having to login again and again gets to be a real pain. I did find the solution for this and while I'd like to send a kudos, I cannot find the original link so I am documenting it here.

The default setting for Windows is to timeout after 1 minute - this can be very agitating when working on something. The purpose of this change is to a) Remove the password requirement and b) Disable the timeout (or  you can set the timeout to something longer like 10 minutes).

To start off with, you MUST login using the Administrator account. While an Admin account can change the Registry, power settings can only be changed by the Administrator.

Step 1: Modify the Registry

By default, the option to change the timeout is not available (and in fact not shown). To get this to show, we have to modify the registry setting to enable it.

Open a command window (running As Administrator) and enter Regedit (or use the Run command). When the Registry opens, navigate to:

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Power/PowerSettings

Locate the GUID 7516b95f-f776-4464-8c53-06167f40cc99 and expand it. Next locate the GUID 8EC4B3A5-6868-48c2-BE75-4F3044BE88A7 and click to open it. On the right hand side, you'll see "Attributes":


Double click on Attributes and change the value from 1 to 2:


Click OK to save the change and close Regedit.

Step 2: Open the Control Panel

When you open the control panel, use the Search box to search for the word "power" - this will bring up the Power Options. Click on Change power-saving settings:


If you are not the Administrator, you'll know because the options will be grayed out:
As Administrator, this option is enabled - click Change plan settings:
Next, click the Change advanced power settings link:

The first option you can change is the Password on Wakeup - set this to Yes or No:


Scroll down to the 'Display' section - this is where you can set the timeout - by default, this is One Minute:


To disable completely, set this value to 0 otherwise you can set the value to however many minutes you want:

Click the Apply button and close everything out.

That's it! No more timeout!