Windows – Can I help? https://lemuel.leung.us Lemuel Leung | Hosting Consultant Mon, 20 Jul 2020 08:26:33 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 https://lemuel.leung.us/wp-content/uploads/2019/06/cropped-lemico-32x32.png Windows – Can I help? https://lemuel.leung.us 32 32 Cloudflare and WordPress multisite https://lemuel.leung.us/cloudflare-and-wordpress-multisite/ https://lemuel.leung.us/cloudflare-and-wordpress-multisite/#respond Tue, 18 Feb 2020 17:29:10 +0000 https://lemuel.leung.us/?p=554 Read more about Cloudflare and WordPress multisite[…]]]> Issue: Site uses Cloudflare and uses flexible SSL to serve pages. However, within WordPress, any http:// referenced sources are being referenced as http:// instead of https://

Solution 1: For the site in question, you can force resources to automatically upgrade. Put the following line in your .htaccess file:

Header always set Content-Security-Policy: upgrade-insecure-requests

An explanation of what that does is listed here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests

Solution 2: Insert this script below your functions.php file in your child theme and they should load again (but note, updating the theme might break this and you will need to do it again):

 function ssl_srcset( $sources ) {
 foreach ( $sources as &$source ) {
 $source['url'] = set_url_scheme( $source['url'], 'https' );
 } 
 return $sources;
 }
 add_filter( 'wp_calculate_image_srcset', 'ssl_srcset' );

Credit:
http://docs.layerswp.com/doc/wordpress-images-dont-load-after-4-4-update-with-ssl-enabled/

]]>
https://lemuel.leung.us/cloudflare-and-wordpress-multisite/feed/ 0
WordPress/MySQL change URLs https://lemuel.leung.us/wordpress-mysql-change-urls/ https://lemuel.leung.us/wordpress-mysql-change-urls/#respond Tue, 18 Feb 2020 17:22:20 +0000 https://lemuel.leung.us/?p=552 ; SHOW TABLES; Grab site URLs SELECT * FROM wp_options WHERE option_name = 'home'; SELECT * FROM wp_options WHERE option_name = 'siteurl'; **NOTE** Multisite setups are different. Each site has their own set of wp_options, depending on your site, it may be set Read more about WordPress/MySQL change URLs[…]]]> Connect to MySQL and view tables to see what you need

USE <DB_NAME>;
SHOW TABLES;

Grab site URLs

SELECT * FROM wp_options WHERE option_name = 'home';
SELECT * FROM wp_options WHERE option_name = 'siteurl';

**NOTE** Multisite setups are different.  Each site has their own set of wp_options, depending on your site, it may be set to different numbers.  Typically, it will be wp_2_options, wp_3_options, etc.

Replace values with what you want

UPDATE wp_options SET option_value="http://new_host/wordpress" WHERE option_name = "home";
UPDATE wp_options SET option_value="http://new_host/wordpress" WHERE option_name = "siteurl";

**NOTE** For multisite setups, make sure your wp_options match the number for the site in question.  
]]>
https://lemuel.leung.us/wordpress-mysql-change-urls/feed/ 0
Connection errors from WordPress to Azure MySQL database https://lemuel.leung.us/connection-errors-from-wordpress-to-azure-mysql-database/ https://lemuel.leung.us/connection-errors-from-wordpress-to-azure-mysql-database/#respond Thu, 31 Oct 2019 06:35:23 +0000 https://lemuel.leung.us/?p=504 Read more about Connection errors from WordPress to Azure MySQL database[…]]]> Issue: You are getting connection issues to your hosted Azure MySQL database server. You are putting the correct information in, but still WordPress is showing Error Connecting to Database.

Error: After some investigation, you most likely are getting this error:

mysqli_real_connect(): (HY000/9002): SSL connection is required. Please specify SSL options and retry

Resolution: Believe it or not, this is a simple one. Azure REQUIRES that your connection to the database uses SSL.

Simply put the following line in your wp-config.php file and all will be well. I typically include a description for my own reference

/** Secure Connection to Azure MySQL db */
define(‘MYSQL_CLIENT_FLAGS’, MYSQLI_CLIENT_SSL);

]]>
https://lemuel.leung.us/connection-errors-from-wordpress-to-azure-mysql-database/feed/ 0
WordPress troubleshooting https://lemuel.leung.us/wordpress-troubleshooting/ https://lemuel.leung.us/wordpress-troubleshooting/#respond Sat, 29 Jun 2019 05:58:41 +0000 https://lemuel.leung.us/?p=487 Read more about WordPress troubleshooting[…]]]> Issue: You are having trouble with your WordPress installation and can’t figure out exactly the issue. It may be that you are on a server and have limited visibility.

Resolution: Save the following four lines, these are a MUST for those who are moving sites across platforms or to another host.

ADD THE FOLLOWING TO YOUR WP-CONFIG.PHP FILE

define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, true);
define(‘WP_DEBUG_DISPLAY’, false);
ini_set(‘display_errors’, 0);

Once these settings are turned on, you will be able to navigate to your root folder, wp-content folder, and a new file will pop up: debug.log

Troubleshoot away! Your debug.log file will contain all that you need to figure out the issue.
]]>
https://lemuel.leung.us/wordpress-troubleshooting/feed/ 0
Script for Chrome cache multiple users https://lemuel.leung.us/script-for-chrome-cache-multiple-users/ https://lemuel.leung.us/script-for-chrome-cache-multiple-users/#respond Mon, 28 Aug 2017 03:08:17 +0000 https://lemuel.leung.us/?p=385 Read more about Script for Chrome cache multiple users[…]]]> I found a script this very useful script. It does a good job of cleaning the Chrome cache in user profiles on a terminal server.

Original Post: https://community.spiceworks.com/topic/1425012-clear-chrome-cache-for-multiple-users-on-file-server

Thanks!

========

@ECHO On

TASKKILL /F /IM Chrome.exe /T

for /f %%a in (‘dir c:\users /b’) do (

rd “c:\users\%%a\AppData\Local\Google\Chrome\User Data\Default\Cache” /s /q

del “c:\users\%%a\AppData\Local\Google\Chrome\User Data\Default\*history*.*” /s /q

del “c:\users\%%a\AppData\Local\Google\Chrome\User Data\Default\*History Provider Cache*.*” /s /q

del “c:\users\%%a\AppData\Local\Google\Chrome\User Data\Default\*cookies*.*” /s /q

)

exit /b 0

]]>
https://lemuel.leung.us/script-for-chrome-cache-multiple-users/feed/ 0
Script for disk cleanup https://lemuel.leung.us/script-for-disk-cleanup/ https://lemuel.leung.us/script-for-disk-cleanup/#respond Mon, 13 Mar 2017 08:21:36 +0000 https://lemuel.leung.us/?p=330 Read more about Script for disk cleanup[…]]]> @echo off
REM Install Disk Cleanup based on Windows Version

ver | findstr /i “6\.0\.” > nul
IF %ERRORLEVEL% EQU 0 goto ver_2008
ver | findstr /i “6\.1\.” > nul
IF %ERRORLEVEL% EQU 0 goto ver_2008R2
goto warn_and_exit

:ver_2008
:Run Windows 2008 specific commands here
echo OS Version: Windows 2008
IF NOT EXIST “%SYSTEMDRIVE%\Program Files (x86)” goto ver_2008_x86
echo 64-bit

copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe C:\Windows\System32\
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui C:\Windows\System32\en-US\
cleanmgr.exe

goto end

:ver_2008_x86
echo 32-bit

copy C:\Windows\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe C:\Windows\System32\
copy C:\Windows\winsxs\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_5dd66fed98a6c5bc\cleanmgr.exe.mui C:\Windows\System32\en-US\
cleanmgr.exe

goto end
:ver_2008R2
:Run Windows 2008R2 specific commands here
echo OS Version: Windows 2008 R2

copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe C:\Windows\System32\
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui C:\Windows\System32\en-US\
cleanmgr.exe

goto end

:warn_and_exit
echo Machine OS cannot be determined.

:end

]]>
https://lemuel.leung.us/script-for-disk-cleanup/feed/ 0
Virtual Servers/Workstations not showing up in WSUS https://lemuel.leung.us/virtual-serversworkstations-not-showing-up-in-wsus/ https://lemuel.leung.us/virtual-serversworkstations-not-showing-up-in-wsus/#respond Thu, 01 Sep 2016 19:51:25 +0000 https://lemuel.leung.us/?p=318 Read more about Virtual Servers/Workstations not showing up in WSUS[…]]]> Issue:  Virtual servers/workstations deployed from the same image do not show up in WSUS.  You notice that in WSUS groups that the machine listing rotates machine names everytime you refresh, but never lists them separately.

Cause:  This is caused by having the same SSID when deployed.  When sysprep is not run to prepare the image, then the machine may exhibit this behavior.  Please note:  This behavior is not consistent, but for the ones that are missing, you need to do some tweaking to get this working.

Resolution:  

  1. After your GPO is applied correctly, stop the Windows Update service.  Command prompt –> net stop wuauserv
  2. Delete the following registry keys:
    • REG DELETE “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate” /v AccountDomainSid /f
    • REG DELETE “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate” /v PingID /f
    • REG DELETE “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate” /v SusClientId /f
  3. Restart the Windows Update service.  Command prompt –> net start wuauserv
  4. Run the following command for local machine to regenerate WSUS ID.  Command prompt –> wuauclt /resetauthorization /detectnow

Give it some time and check in to make sure the machine is now showing in WSUS.  This item should apply to Windows 2012 servers, although I tried this on Windows 2008 servers only.

]]>
https://lemuel.leung.us/virtual-serversworkstations-not-showing-up-in-wsus/feed/ 0
Rewrite Rule – Force https https://lemuel.leung.us/rewrite-rule-force-https/ https://lemuel.leung.us/rewrite-rule-force-https/#respond Tue, 16 Aug 2016 06:51:10 +0000 https://lemuel.leung.us/?p=309 Read more about Rewrite Rule – Force https[…]]]> Issue:  You have a particular domain on a Windows server that you want to force the URL to rewrite to the SSL certificate that is installed.  ie.

http://www.domain.com –> https://www.domain.com

Option 1:  If you know how to edit the web.config file, just paste the following text within your system.webserver tags:

<rule name=”forceHTTPS” stopProcessing=”true”>
<match url=”(.*)” />
<conditions>
<add input=”{HTTPS}” pattern=”off” />
</conditions>
<action type=”Redirect” redirectType=”Found” url=”https://{HTTP_HOST}/{R:1}” />
</rule>

Option 2:  Using the IIS Manager, follow these steps.

  1. Under sites, select the site that you want this rule to apply to
  2. On the right pane, you will see URL Rewrite, double click it (if it’s not installed, then you have to install it as a feature [Windows 2008] or see my Windows 2012 article entitled:  URL Rewrite Module in Windows 2012, where is it? for instructions on how to enable it)
  3. Select “Add Rule(s)…”
  4. Blank rule and name the rule whatever you want it to be
  5. In the Match URL section, under Pattern:, put in (.*)
  6. Go to the Conditions section, click Add
  7. Condition input:  {HTTPS}
  8. Check if input string:  Matches the Pattern
  9. Pattern:  off
  10. put a check mark in Ignore Case, and click OK
  11. In the Action section, select “Redirect”
  12. Action Properties:  https://{HTTP_HOST}/{R:1}
  13. put a check mark for Append query string
  14. Redirect type:  Permanent (301)
  15. Hit Apply
]]>
https://lemuel.leung.us/rewrite-rule-force-https/feed/ 0
CBS.log file huge? Can I delete the files? https://lemuel.leung.us/cbs-log-file-huge-can-i-delete-the-files/ https://lemuel.leung.us/cbs-log-file-huge-can-i-delete-the-files/#respond Wed, 20 Jul 2016 05:16:07 +0000 https://lemuel.leung.us/?p=300 Read more about CBS.log file huge? Can I delete the files?[…]]]> Problem:  In the c:\windows\Logs\CBS folder, you see that there is a huge cbs.log file and/or other cbspersist_0000.cab files that are huge in size (some over 2Gb).  Can these be deleted?

Resolution:  In short, yes, IF you are sure that there is nothing wrong with the system in question.  Typically, if your system is a production system, it is best to move the files and then test to see if everything still functions normally.  If you are in a virtual environment, snapping the server before you do anything should be a rule of thumb.

STEPS:

  1. Navigate to your services and stop the “Windows Module Installer” service
  2. Move/Delete anything that starts with cbs***.log or cbs***.cab files from the folder.
  3. Restart the “Windows Module Installer” service (you should see it regenerate a new cbs.log file)

The cbs.log file should not go over 50 Mbs, but sometimes it errors out and things like these happen.  Perform the above steps.  It hasn’t failed me yet!

]]>
https://lemuel.leung.us/cbs-log-file-huge-can-i-delete-the-files/feed/ 0
WSUS 3.0 sp2 not showing Windows 2012 servers https://lemuel.leung.us/wsus-3-0-sp2-not-showing-windows-2012-servers/ https://lemuel.leung.us/wsus-3-0-sp2-not-showing-windows-2012-servers/#respond Thu, 16 Jun 2016 18:27:20 +0000 https://lemuel.leung.us/?p=297 Problem:  WSUS does not display the Windows 2012 servers even though group policy has been applied.  You run gpresult /r and see that there are no issues group policy-wise.

Resolution:  WSUS needs to be updated with the following patch.  This will allow for the servers to be displayed properly.

https://support.microsoft.com/en-us/kb/2734608

]]>
https://lemuel.leung.us/wsus-3-0-sp2-not-showing-windows-2012-servers/feed/ 0