Saturday, October 2, 2021

Solved : The user profile failed to attach. The process cannot access the file becase it is being used by another process

Issue :  The user profile failed to attach. Please contact Support.

Status : 0x0000000B, Message: Cannot open virtual disk

Error Code: 0x00000020, Message: The process cannot access the file becase it is being used by another process


Solution : 

Connect to Azure:

# Connect-AzAccount

Select the subscription of the target storage account:

# Select-AzSubscription -subscriptionid "SubscriptionID"

Create context for the target storage account:

# $Context = New-AzStorageContext -StorageAccountName "StorageAccountName" -StorageAccountKey "StorageAccessKey"

Get Current open files
Get-AzStorageFileHandle -Context $Context -ShareName "WVDUserProfilesShareName" -Recursive | Sort-Object ClientIP,OpenTime

Close an open handle:

# Close-AzStorageFileHandle -Context $Context -ShareName "WVDUserProfilesShareName" -Path 'New folder/Profile_Username.vhd' -CloseAll



Tuesday, August 31, 2021

Solved | SendGrid SSL CERTIFICATE_VERIFY_FAILED certificate verify failed | self signed certificate in certificate chain

Error :  

PS C:\Ashish> & "C:/Program Files/Python39/python.exe" c:/Folder/SendEmail.py

Traceback (most recent call last):

  File "C:\Program Files\Python39\lib\urllib\request.py", line 1346, in do_open

    h.request(req.get_method(), req.selector, req.data, headers,

  File "C:\Program Files\Python39\lib\http\client.py", line 1279, in request

    self._send_request(method, url, body, headers, encode_chunked)

  File "C:\Program Files\Python39\lib\http\client.py", line 1325, in _send_request

    self.endheaders(body, encode_chunked=encode_chunked)

  File "C:\Program Files\Python39\lib\http\client.py", line 1274, in endheaders

    self._send_output(message_body, encode_chunked=encode_chunked)

  File "C:\Program Files\Python39\lib\http\client.py", line 1034, in _send_output

    self.send(msg)

  File "C:\Program Files\Python39\lib\http\client.py", line 974, in send

    self.connect()

  File "C:\Program Files\Python39\lib\http\client.py", line 1448, in connect

    self.sock = self._context.wrap_socket(self.sock,

  File "C:\Program Files\Python39\lib\ssl.py", line 500, in wrap_socket

    return self.sslsocket_class._create(

  File "C:\Program Files\Python39\lib\ssl.py", line 1040, in _create

    self.do_handshake()

  File "C:\Program Files\Python39\lib\ssl.py", line 1309, in do_handshake

    self._sslobj.do_handshake()

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "c:\Ashish\Send.py", line 26, in <module>

    response = sg.send(message)

  File "C:\Program Files\Python39\lib\site-packages\sendgrid\base_interface.py", line 62, in send

    return self.client.mail.send.post(request_body=message)

  File "C:\Program Files\Python39\lib\site-packages\python_http_client\client.py", line 277, in http_request

    self._make_request(opener, request, timeout=timeout)

  File "C:\Program Files\Python39\lib\site-packages\python_http_client\client.py", line 176, in _make_request

    return opener.open(request, timeout=timeout)

  File "C:\Program Files\Python39\lib\urllib\request.py", line 517, in open

    response = self._open(req, data)

  File "C:\Program Files\Python39\lib\urllib\request.py", line 534, in _open

    result = self._call_chain(self.handle_open, protocol, protocol +

  File "C:\Program Files\Python39\lib\urllib\request.py", line 494, in _call_chain

    result = func(*args)

  File "C:\Program Files\Python39\lib\urllib\request.py", line 1389, in https_open

    return self.do_open(http.client.HTTPSConnection, req,

  File "C:\Program Files\Python39\lib\urllib\request.py", line 1349, in do_open

    raise URLError(err)

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)>

Issue : 

Sendgrid Certificate Chain is not valid in Windows Certificate Store. You can check it by visiting Sendgrid.com website from Windows Server.



Solution : 

Goto https://certs.godaddy.com/repository

1. Download G2 Certificate 

2. Install it in Trusted Root Authority Store.

3. After installation, the root certificate should show OK.



Thursday, June 8, 2017

Automating Windows Updates using PowerShell

Scenario : Windows Server Operating Systems (2008 R2, 2012, 2012 R2, 2016)

Issue : Managing the Windows Updates for multiple servers is a complex task. This can be simplified using PowerShell.

Michal Gajda from Microsoft forum has done a wonderful job by creating custom PowerShell Module for Managing windows updates thru PowerShell.

Link for the Module : https://goo.gl/qJHorX

Description : The PSWindowsUpdate module allow you to manage Windows Update on your computer. Module contain set of function to check, download and install or remove update from local machine. Especially useful on machines in core edition like Windows Server 2008 R2 or later.

Steps :

  1. Download : Download the ZIP from above link ( https://goo.gl/qJHorX).
  2. Module can be installed manually by downloading Zip file and extract in two places:
    • %USERPROFILE%\Documents\WindowsPowerShell\Modules
    • %WINDIR%\System32\WindowsPowerShell\v1.0\Modules
  3. Importing the module
    PS > Import-Module PSWindowsUpdate
  4. Enable RemoteExecution on Servers where you are going to Deploy Updates using following PowerShell Command
    Set-ExecutionPolicy RemoteSigned
    image
  5. Invoke following command to Initiate the Installation of Tool on Remote Computer and Install the Latest available updates.
    Invoke-WUInstall -ComputerName encxenlic.encnet.com -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -Force | Out-File -Append C:\PerfLogs\PSWindowsUpdate.log } -Confirm:$false –Verbose

    Above command will copy module files on Remote Computer.
    It will remotely install the PSWindowsUpdate module
    Execute Download and Update the Windows Update command
    It will NOT Restart the Windows Server
    It will save/append log file on the Path C:\PerfLogs\PSWindowsUpdate.log
  6. You can check the Windows Update status after sometime.
  7. Only Issue which I encountered is, it will not produce any log in the Event Log (System) and in Recently Installed updates.
Hope that it will save your valuable time.

Let me know if it helped you and if you have any query in comment.

Friday, June 2, 2017

Resolved | Windows Server 2008 R2 SP1 Update Fails

Issue: Windows Server 2008 R2 SP1 Installation fails

Environment: Windows Server 2008 R2 Operating System OS

Solution:

1) Open Windows Explorer and navigate to C:\Windows\Inf folder

2) Cut and Paste following files starting with name USB in another safe location:
image
3) Install the SP1 Update

4) After successful installation, place those files back.

Comment if this solution works for you.

Thursday, June 1, 2017

Fixed | WSUS 2016 | Error Code 0x8024401c | Windows 10 | Windows Server 2016

Scenario :

Server : Windows WSUS Server 2016
Client : Windows 10, Windows Server 2016

Error Code :  0x8024401c on Windows 10 or Windows Server 2016


Solution :
1) Go to IIS Manager on WSUS Server


2) Goto Advance Settings of  WsusPool.


3) Make sure following settings are present/configured on the Pool, if not change it to below:
Queue Length: 25000
Limit Interval (minutes): 15
"Service Unavailable" Response: TcpLevel
Private Memory Limit (KB): 0


4) Make sure, the WSUS Entry in the Registry is having fully qualified domain name of WSUS Server.

image

5) Stop the IIS

6) Edit the web.config located at following location on WSUS Server :
C:\Program Files\Update Services\WebServices\ClientWebService\web.config

Replace
<httpRuntime maxRequestLength="4096" />
with
<httpRuntime maxRequestLength="204800" executionTimeout="7200"/>

7) Start the IIS

8) Retry updating clients.

Done!

Let me know if it has helped to you.

Source : https://community.spiceworks.com/topic/1970827-wsus-on-server-2016-windows-10-1607-client-0x8024401c-error

Solved : The user profile failed to attach. The process cannot access the file becase it is being used by another process

Issue :  The user profile failed to attach. Please contact Support. Status : 0x0000000B, Message: Cannot open virtual disk Error Code: 0x000...