Tag Archives: configuration

How to check my CPU Temperature using PowerShell Remotely

Thought it would be helpful to share how to remotely check your Computer temperature especially when you have a computer at home and you want to track if it is HOT. Just in case you don’t want to burn your computer etc etc, for whatsoever reason.

Well. Steps below show you how to do that! Make sure your client machine (the one that you are using) has PowerShell version 2.0 and above (well most of the Windows nowadays has it already). Just do a Search in your program menu and you should see it

  1. First of all, ensure your target computer (the one sitting at home that you want to check) has Firewall Turn off (not recommended). Alternatively, set Exception rules for WMI rules.
    Very briefly, go to “wf.msc” – Windows Firewall of the target computer and enable Inbound Rules for “Windows Management Instrumentation (WMI-In)” – Profile: Domain.
    remotely check cpu temperature - 1
    See detail steps here 
  2. Once firewall is cleared, make sure you have local administrator rights account that can query the CPU temperature in the target computer. (this one is simple) Fire “lusrmgr.msc” in the Run command.
    Check the “Administrators” group and make sure your account is the member.
  3. In order for you to be able to remotely check your computer temperature, you must have connectivity to your target computer. I believe there could have many way you can have connectivity to your target computer. Of what I know, the below three should be enough to fulfill the task
    1. One that I always like to use is Teamviewer. With this, you can easily establish VPN or remotely login to run the script mention in Step 4. (without specifying the -Computer and -Credential).
      Make sure when you install the Teamviewer, you have the VPN Driver installation option ticked.
    2. Allowing RDP to your target computer from public IP. In this option, you need to configure your Home Router to allow port 3389 to hit your target computer. Please go to your router admin page (usually ends of 192.168.0.1 or  192.168.1.1 depending on which is your subnet) and configure port forwarding to your private IP.
      In this way, you will be doing the same steps as option 1 where the only difference is you remotely accessing your home computer and run the script directly onto the target computer. Again, without specifying the -Computer and -Credential parameter in step 4)
    3. Option 3 is kinda most complete one and if you want to learn a little bit deeper for WMI. In this option, you will be granting DCOM port (135) and a fixed port (24158) port forwarding to your remote compute (which is accessible via public IP like what you’ve done in option 2). Refer here for how to fix WMI port.Screen shot example on how I configured the WMI to fixed port. (please pardon the typo)
      configure WMI to fixed port
      At the end of the day, your target computer but be accessible via DCOM port and WMI port from public IP.
  4. Open PowerShell via Administrator rights and run the following PS command

    Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace “root/wmi” -ComputerName “<IP of your target computer>” -Credential (Get-Credential)

    You will be prompted to specify the credential, use the account that you have administrator rights mentioned in step 2 above.
  5. You should be expecting response like screen below
    remotely check cpu temperature - 3
  6. Look for “CurrentTemperature” and the value is in Celsius

an unrecognized http response was received trustfailure could not establish trust relationship ssl/tls

I was having this error generated from my SharePoint 2013 Crawl Log saying the HTTP response is not recognised when it was trying to crawl my SharePoint Webs

This error came out after configuring a subscribed SSL certificate from Entrust (it may happen to all other vendor too I bet) in IIS.

After digging the Application Log of my SharePoint 2013 server which is running the crawling, Error like below was shown:

An operation failed because the following certificate has validation errors:
Subject Name: CN=xxxx, OU=XXX.
 Thumbprint: xxx
Errors:
PartialChain: A certificate chain could not be built to a trusted root authority.
 RevocationStatusUnknown: The revocation function was unable to check revocation for the certificate.
 OfflineRevocation: The revocation function was unable to check revocation because the revocation server was offline.

After reading this error message, it reminds me that I have a chain certificate provided by the SSL vendor which it is asked to import this chain to my server’s certificate store

For SharePoint, You will need to do additional steps to configure this! If you happen to see this error, please kindly perform the following steps:

  1. Import the Chain Certificate from your SSL vendor and save into your server.
  2. Go to Central Admin > Security > Manage Trust
  3. Click “New” in the Trust Relationships tab
  4. Enter the name for the trust and browse the imported Chain Certificate.
  5. Click Ok to create the trust. You shall see your new trust being added
  6. Perform a full crawl again and you shall see the Crawl Log starts generating results

Note: Ticking the “Ignore SSL Warning” in Farm Search Administration page does not help. Have tried that and it didn’t work. The above steps should suffice.

Change the default settings for newly created SharePoint Document Library

Thought it would be helpful to share this.

As you know, SharePoint Document Library by default, if you just simply create one, are not turned on with Version Control. This could rather prone to human mistake or mis-configuration whenever you need to provision a new document library.

This is how I fulfill this.

Imagine i need to have the version control turn on, and with the following settings

version history limits

What you need to do is to create a custom event receiver with List Added handler

Fire up your Visual Studio, create a SharePoint Farm solution and add your new event receiver

New Event Receiver

Select List Events and tick “A list was added”

Event Receiver Setting

In the ListAdded method, kindly do a checking before the code is firing, the below TemplateId 101 means Document Library


if (properties.List != null && properties.TemplateId == 101 && properties.Web != null)
 {

try
 {
 SPList docList = properties.List;//.Lists[properties.ListId];
 docList.EnableVersioning = true;
 docList.EnableMinorVersions = true;
 docList.MajorVersionLimit = 3;
 docList.MajorWithMinorVersionsLimit = 20;

//this.EventFiringEnabled = false;
 docList.Update();
 }
catch (Exception ex)
 {

//Do something...

}

}

If you do this, you will hit this error when creating a new document library

The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.

This is due to the Synchronisation mode for ListAdded event by default is “Asynchronous”.
You MUST DO the following

Open the Element.xml created via Visual Studio.
Add a “<Synchronization>Synchronous</Synchronization>” node into your receiver xml

<Receiver>
 <Name>SharePointSettingEventReceiverListAdded</Name>
 <Type>ListAdded</Type>
 <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
 <Class>MOT.EventReceiver.SharePointSettingEventReceiver.SharePointSettingEventReceiver</Class>
 <SequenceNumber>10000</SequenceNumber>
 <Synchronization>Synchronous</Synchronization>
 </Receiver>
 </Receivers>

Deploy your solution and hooray~

SharePoing Global Navigation for SubSite not showing Parent Sites Nodes

Despite setting the properties “UseShared” for SPWeb object to “True”, it does not show the correct Parent’s Global Navigation nodes.

I have this requirement where the subsites (3rd level, where 1st level being the root web) in second level web (which is also inheriting from root web) needs to display the global navigation nodes.

After trying


mySubSite.Navigation.UseShared = true;

it does not show the actual parent’s global navigation, instead, it shows “[Portal Name]” which redirect to root web’s home page. If you go to “Site Settings” > “Navigation” and click “Save” button, it will subsequently show the correct nodes. Meaning, doing it in UI is fine but doing it programmatically is NOT OKAY!.

After digging into the Microsoft.SharePoint.Publishing.dll. I found this is the workaround.

 Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings settings = new Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings(web);
 settings.GlobalNavigation.Source = Microsoft.SharePoint.Publishing.Navigation.StandardNavigationSource.InheritFromParentWeb;
 settings.Update();
<pre>

This will then make the subsite showing the correct one.

Distributed Cache Status Down, CacheHostInfo is null

This problem troubled me for like 2 days consecutively while i have to stay in the data center (with the crazily cool air-con) to troubleshoot, its kinda driving me crazy.

I have two (2) SharePoint 2013 app servers to be running Distributed Cache services. Each to be allocated with 8 GB RAM. When i setup one of the Distributed Cache server (running alone), it was fine. The issue came when i tried to start the other SharePoint App server (within the same SharePoint farm) to run the Distributed Cache service, the App Fabric Caching Services stuck at “Starting” status for about 5 mins+  Subsequently, error thrown to System Log file saying the service terminated unexpectedly.

I Followed Technet guide and it doesn’t work.

Tried to “Remove-SPDistributedCacheServiceInstance”, it loaded for a long long time then thrown “net.tcp://<servername>/” times out.

In the Central Admin > Manage Services on server. Selected the Not-working app server. I found the Distributed Cache service is not started. Click on the “Start” link, it threw “Cachehostinfo is null” friendly message…

Tried Get-SPServiceInstance to get the broken distributed cache instance, deleted and rerun “Add-SPDistributedCacheServiceInstance”, it loaded, again for a lon glong time.

Tried

Remove-CacheHost
Add-CacheHost -ProviderType "SPDistributedCacheProvider -ConnectionString "Data Source=<SPSQL ALIAS>;Initial Catalog=Config;Integrated Security=True;Enlist=False"
#####

Still no help.

After checking the window System Log file, i noticed this error was thrown somewhen during the process.

Event ID 4
####
The kerberos client received a KRB_AP_ERR_MODIFIED error from the server &lt;My Broken Server Name&gt;. 
The target name used was &lt;My Service Account&gt;. This indicates that the password used to encrypt the kerberos 
service ticket is different than that on the target server.
####

Fishy enough.

If you are having this problem, you can consider the following step

My Resolution

  1. Check Network Connection for both your SharePoint servers that are running the Distributed Cache.
  2. Go to the Properties of the connection
  3. Double click “Internet Protocol Version 4 (TCP/IPv4)
  4. Ensure both servers are using SAME and WORKING DNS Servers. Reason why is that my servers were having two Domain Controllers (one for backup replication purposes). For some reason, the DCs cannot talk to each other.
  5. Remove the Alternate DNS Server as for now.
  6. Try to Remove-SPDistributedCacheServiceInstance and Add-SPDistributedCacheServiceInstance for the non-working app server.

Hope it solves your problem =)

Visual Studio 2012 does not have SharePoint 2013 template

Funny thing occurred when i try to open Visual Studio 2012 and there is no Project Template for SharePoint 2013.

If you are having the same problem. Probably you need to install the following item

Microsoft Web Platform Installer 4.5

http://www.microsoft.com/web/downloads/platform.aspx

Once installed, open this Web Platform Installer and look for One of the key components is the Visual Studio

Microsoft Office Developer Tools for Visual Studio 2012

You should be able find it under “Products” >”Tool” category.

Download it !

How to configure AppFabric Caching Memory Usage

In the server that runs the AppFabric Services.

Open the Windows Menu and type “SharePoint 2013 Management Shell” and run as Administrator

Enter the following power shell command

Update-SPDistributedCacheSize -CacheSizeInMB <your prefer value>

E.g.
Update-SPDistributedCacheSize -CacheSizeInMB 200


To enable SharePoint Distributed Cache Services
Run the following script using ShellAdmin account
Add-SPDistributedCacheServiceInstance

SharePoint 2013 Pre-requisite Error – Application Server Role and Web Server (IIS) Role

Bumped into  this error when trying to manually setup SharePoint 2013 pre requisite installation.

The Configuration stopped at step Configuring Application Server Role and Web Server (IIS) Role.

SP2013 Error - Pre-requisite App Server and Web Server

Resolution

  1. Go to Server Manager > Add Roles and Features
  2. Select Your server in the Server Pool under Server Selection page
  3. Select Web Server (IIS) Role
  4. Click Next until the wizard finishes
  5. Rerun the Pre-requisite setup and the error is gone.

Setting up a Single-box SharePoint 2013 Virtual Machine.

First thing first, below are some files which you would need in order to setup your own SP2013 Environment. VMware Workstation 9 – here SharePoint 2013 – here SQL 2012 – here Windows 2012 Server – here Visual Studio 2012 – here Here we go.

VMWare Workstation

  1. Install VMWare Workstation on to your local PC, Ensure that your local PC has got at least 8 gb RAM. You would need to allocate some of the RAM to your 2012 server later.
  2. Once completed the Workstation installation (i would not go through how you install software as it is simple), create a “New virtual machine“, choose Typical installation, PLEASE select option “I will install the operating system later“, else you will encounter error later. Then click Next until the vm files are created in your document folder “Documents\Virtual Machines\Windows Server 2012”
  3. Before powering on your vm, please map your Windows Server 2012 ISO file to boot up and install.

Windows Server 2012

  1. There is nothing much critical to explain here. Just follow the setup wizard.
  2. Once completed, you will be asked to enter the administrator password bla bla bla.
  3. Remember to rename your windows name to something meaningful.. NOT Something like win-is2xx92243d which is totally making no sense. To configure this, go to Server Manager > Local Server > Click Computer Name > Change > Rename your server and click OK.Configure Windows 2012 Computer Name
  4. Restart your computer.
  5. Next, it is always good to set your Server IP address. Though this is not actually required for a Single Box Setup. But good to learn? =) Configure Server IP Windows 2012 1 then Configure Server IP Windows 2012 2
  6. Next is to setup Active Director Domain Services (AD DS), this is required for you to create services account for sharepoint and sql later on. Note! dcpromo.exe is deprecated for windows 2012. Sadly.
  7. Kindly go to Server Manager > Dashboard > Add Roles and Features
  8. Select Role-based or Feature-based installation
  9. Select your server from the Server Pool list and click “Next”
  10. Check on “Active Director Domain Services” check box, a prompt up will be displayed. Click “Add Feature”.
  11. Now, click NEXT all the way down until the installation completed.

Promote Windows 2012 to a Domain Controller

  1. Once your server 2012 added AD DS, you have to promote your server to a domain controller.
  2. In the Server Manager, you may notice this Alert icon. Click on it and click on “promote this server to a domain controller”. Configure Domain Controller Windows 2012 1
  3. In the “Active Director Domain Services Configuration Wizard”, Select Add a new forest, put your favorite name. Configure Domain Controller Windows 2012 1
  4. Click Next, leave the rest default and specify your DSRM Password Configure Domain Controller Windows 2012 2
  5. Click Next all the way down until you see “Install” button. Kindly ignore those warning message. Click Install. Reboot and  you are done with DC Promo.

Service Account

  1. Now that your DC is up, you would need FEW accounts to setup your SharePoint 2013 environment. Note that i did not mention how many account required, because, ultimately, it depends on how segregated you want your farm to be. For Single Box solution and Less Error Prone. You may only need 3 accounts.
    1. Setup user account
    2. Server farm account or database access account
    3. SQL Server service account.
  2. Refer here  and here for the detail account.
  3. Open Run (Windows + R) then enter “dsa.msc” to open Active Director Users and Computers.
  4. Right Click  your Domain and add a new OU (this is my usual practice to park my sp account into an OU) Configure Service Account 1
  5. Add those 3 accounts.

SQL 2012

  1. Map your “SQLServer2012SP1-FullSlipstream-ENU-x64.iso” file to vm
  2. Run the ISO file in your VM, Select Installation Tab on the left and click New SQL Server stand-alone installation or add features to an existing installation.
  3. Click OK after the Setup Support Rules is completed, enter your product key (if you don’t have, use evaluation =D ), click OK. Include SQL Product Updates. Click OK~ These are pretty boring. Configure SQL 2012 2
  4. Next, select Role Mode. For evaluation purpose, i select All features with default.
  5. Name your SQL Instance
  6. Specify your services account. In my case, i use “SQL Server service account” that i have created previously. Configure SQL 2012 4
  7. Specify the Admin Account using the same SQL Server service account. account. (Well, this is for evaluation, you can still opt to use other account) Configure SQL 2012 5
  8. Analysis Configuration – Specify the same service account.
  9. Distributed Replay Controller – Specify the same service account and the Controller Name as your Server Name
  10. Click NEXT, NEXT, NEXT to install.. go get a coffee and come back after 30 mins…
  11. ..
  12. OK~ Next thing is to get setup the SharePoint Setup Account permission. Base on the article here. You have to grant the account (In my case “spsetup”) with DBCreator and SecurityAdmin permission.
  13. At this time, your server only allow Windows Authentication mode to access to your Database Engine. Please kindly Grant the SQLService account with Local Administrator right temporary. Log Off and switch to this account.
  14. Open your SQL Management Studio, Login via Windows Authentication, Right click on the “Login” node and “New Login”
    Configure SQL 2012 5.5
  15. Select the SharePoint Setup Account “spsetup” and go to Server Roles. Check the 2 server roles “dbcreator” and “securityadmin”
    Configure SQL 2012 6
  16. Click OK to proceed.
  17. For SharePoint 2013, there is one additional step is to change the Max Degree of parallelism to 1. Go to Database Engine, Right Click and Select Property. Under Advanced panel. Change the value to 1.
    Configure SQL 2012 7
  18. Click OK to proceed. Once this is completed, you may Switch User back to SharePoint Setup Account now (via Alt + Del + Insert)Note: Remove the SQLService account from local admin group once you are done with setting up the permissions.

SharePoint 2013

  1. Map your SP2013 iso file to your virtual machine (if you haven’t)
  2. Go into your vm and install SP2013 pre-requisites. The next few steps are for Offline Pre-requisite installation.
  3. Run Powershell with Administrator rights. Ensure you have executed the following command before Set-ExecutionPolicy RemoteSigned
  4. Run the following command. Make sure the path is where you store the pre-requisite files. Also, copy the “prerequisiteinstaller.exe” from your SP2013 iso to the same folder where your script is located.
    $SharePoint2013Path = "C:\Prerequisite"
    Start-Process "$SharePoint2013Path\PrerequisiteInstaller.exe" –ArgumentList "/SQLNCli:$SharePoint2013Path\PrerequisiteInstallerFiles\sqlncli.msi /IDFX:$SharePoint2013Path\PrerequisiteInstallerFiles\Windows6.1-KB974405-x64.msu /IDFX11:$SharePoint2013Path\PrerequisiteInstallerFiles\MicrosoftIdentityExtensions-64.msi /Sync:$SharePoint2013Path\PrerequisiteInstallerFiles\Synchronization.msi /AppFabric:$SharePoint2013Path\PrerequisiteInstallerFiles\WindowsServerAppFabricSetup_x64.exe /KB2671763:$SharePoint2013Path\PrerequisiteInstallerFiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe /MSIPCClient:$SharePoint2013Path\PrerequisiteInstallerFiles\setup_msipc_x64.msi /WCFDataServices:$SharePoint2013Path\PrerequisiteInstallerFiles\WcfDataServices.exe"
    
  5. After running the script, i encountered the following error “The tool was unable to install Application Server Role, Web Server (IIS) Role
  6. After 2 rounds of rebooting. The pre-requisite installation is finally done.
  7. Open the SharePoint Installer Splash Screen and hit Install SharePoint Server.
  8. Put in the Evaluation Product Key. NQTMW-K63MQ-39G6H-B2CH9-FRDWJ
  9. Click Next  until the installation is completed (yawn..)
  10. Once the installation is completed, leave the check box default “Run SharePoint Products Configuration Wizard”. Close your installation wizard.
  11. In the SharePoint Configuration Wizard, click Next.
  12. System will prompt you to stop the 3 services account, IIS, SP Admin Service, SP Timer Service, click Yes to continue.
  13. Select “Create a new server farm” and click OK.
  14. At this point, you may want to setup an ALIAS for SQL connection. (Good practice!)
  15. Fire Up “Run” and enter “cliconfg”.
  16. Under Alias tab, enter “sql” name and select “TCP/IP” and your sql server name (basically the same server since we are setting up a single box server.)
    Configure SharePoint 1
  17. Click OK and exit the CliConfg.
  18. Back to the SharePoint Product Configuration Wizard, enter the ALIAS that you just created as the SQL name.
  19. Next, specify the Login ID for “Server farm account or database access account” created earlier. (In my case “spfarm”).
    Configure SharePoint 2
  20. Specify the passphrase and click Next
  21. Specify the Central Admin port number and the authentication mode. Use NTLM for simplicity.
    Configure SharePoint 3
  22. Click Next to start configuring. Again you can go get some drink and come back like 20 mins time
  23. Tada~
    Configure SharePoint 4
  24. If you open your Task Manager, you will noticed that there is one new windows services running “AppFabric Service” which took you 300++mb of RAM. You may actually reduce the RAM usage to make room for other services. Refer here on how to reduce the AppFabric Memory Usage
  25. Once you close the Product Configuration Wizard, IE will be fired up to performance Configuration. Select all services if you like. Also, you may use a separate service account for the services that you intend to add. I would not recommend turning on Search Service Application as this will take up A LOT OF YOUR MEMORY!!!! Please note. Do it only if you have a lot of RAM in your VM Host.
  26. The Configuration may take quite some time. It happened to me before that it stuck forever. In case the screen doesn’t refresh or whatsoever, try to open the Central Admin again. The Services will still be created at the backend.

Configure SharePoint 5

Create Site Collection

  1. Once the Central Admin is done, you may proceed to create a Site Collection for your primary Web Application – 80
  2. Click on “Create Site Collection” under Application Management tab.
  3. Ensure the Web Application is selected correctly. Put in the Name and select your Site Template
    Configure SharePoint 6
  4. Specify the Primary Site Collection Admin – AHCHENG\spsetup
  5. Click OK!!! and Welcome to SharePoint 2013!

 

Note: If Newsfeed or MySite is having this “We’re almost ready!” error, please kindly check here to add your server as part of cache cluster

Unable to connect the Search Services

I’ve already setup the environment correctly base on the Technet guide.

The farm topology is 1 WFE, 1APP (which runs the Search Service Instance), 1 SQL and 1 Fast Search server.

This error happen after few months of system commission.

Whenever hitting a keyword via the Search Box, this error “Unable to connect the search services” kept throwing.

Resolution

After checking the server system time, i noticed that there is 5++ mins difference between APP Server and Fast Search Server. This time difference will cause the web service call to fail!!

Hence, please ensure that your Search Service Instance server and the FAST Search are in synch with the time. I’ve heard that there is this NTP for servers to synch up the time. You may explore it in detail yourself =)