>NULL: 2022

Friday 30 December 2022

Restoring an Azure VM to earlier disk state from backups (unmanaged disks)

Restore the disks from backup and use Storage Browser in the Azure Portal to place them where you want them, please note they will restore to the root of your Storage Account.

Open Cloud Shell in the Azure Portal and use the following commands to set variables, read the VM configuration, and update the VM configuration with the new OS disk location. 


# Variables for you to fill in

$ResourceGroup = 'RG-Classic'

$VMname = 'winclassic'


#Get the VM config to a variable

$VM = Get-AzVM –Name $VMname –ResourceGroupName $ResourceGroup


#Stop and deallocate the VM

Stop-AzVM –Name $VM.Name –ResourceGroupName $VM.ResourceGroupName –Force


#Swap out the OS disk using the VM variable

$VM.StorageProfile.OsDisk.Vhd.Uri = 'https://rgunmanageddisknew.blob.core.windows.net/vhds/rhclassic-os-2317.vhd' #example, use your new OS disk uri


#Update the VM configuration

Update-AzVM –VM $VM –ResourceGroupName $ResourceGroup


You can now verify the disk location has changed by clicking on the disk in the VM/Disks section and looking at the location.

Data disks can be swapped out within the Azure Portal GUI.


Tuesday 2 August 2022

What is BTWifi-X and how to make your BT mobile automatically login to BTWifi

I've always wondered what BTWifi-X was for, you see it wherever there is a BT router. Turns out it's for the BTWifi app. 

The other day I was on the London Underground and saw there was free Wifi, once above ground I checked and BT mobile customers can follow some steps to get connected.

https://www.bt.com/help/mobile/getting-set-up/london-underground

  1. Make sure your wi-fi is switched on.
  2. Choose EE WiFi-Auto from the available networks.
  3. Once selected, change your EAP method from PEAP to SIM.
  4. Select Connect.

How about we combine the two. Yes! The method BT give for connecting to Wifi on the Underground also works for BTWifi-X as long as you have a BT SIM. A big advantage of this over the app is that it automatically connects you and seems quite reliable in the few weeks since I discovered this.



Friday 29 July 2022

TLS Error in Jet Reports

Error: 

The data source is not properly configured for Office 365 authentication.

You are using TLS version 1.0, 1.1 and/or 3DES cipher which are depreciated to improve the security posture of Azure AD.

 


Solution:

After some back and forth we found the addition of the following reg keys resolved this. Run the following in an elevated PowerShell on the client computer.

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type Dword


 

Wednesday 11 May 2022

Set Windows Power Mode to High Performance via CMD

 Run the following in CMD

powercfg.exe /setactive a1841308-3541-4fab-bc81-f71556f20b4a


 

Tuesday 10 May 2022

Replace AD user object and link back to 365 user #ImmutableID

 An odd situation occurred where I had to delete an AD user then recreate it and link it to the 365 user account.

Here are the steps.

  1. Take a note of the AD user details.
  2. Delete AD user
  3. Run ADSync
  4. The 365 user will have been deleted, un-delete the user on the 365 side.
  5. Create a new AD user with the same properties as the old one.
  6. In PowerShell: Connect-MsolService
  7. In PowerShell: get-MsolUser -UserPrincipalName user@example.com | select ImmutableID
  8. Copy the ID given and keep just in case.
  9. On the AD server: make and run a PowerShell script with the following text

$Users=Get-ADUser -Filter *

function guidtobase64
{
param($str);
$g = new-object -TypeName System.Guid -ArgumentList $str;
$b64 = [System.Convert]::ToBase64String($g.ToByteArray());
return $b64;
}
$ADUsersDump=$Users | Select SamAccountName,UserPrincipalName,@{Expression={(guidtobase64($_.ObjectGUID))}; Label="ImmutableID"}
$ADUsersDump | Export-CSV -Path C:\temp\ImmutableIDs.csv

 

  1. In PowerShell: set-MsolUser -UserPrincipalName user@example.com -ImmutableId ""
  2. In PowerShell: Set-MsolUser -UserPrincipalName user@example.com -ImmutableId <ImmutableID from script output>
  3. Run ADSync
You should now see that the user in 365 is a synced user again.

Thursday 14 April 2022

Useful commands for RDS Session Host servers

I recently had an issue where a user could not login, their session showed disconnected on the RDGateway but I could not log them out vis Server Manager, no session for the user was shown on the Session Host in Task Manager. I used the following commands to find the processes running under that user's account and end them. 

Some processes could not be ended but ending those I could allowed RDGateway to unregister the session and by denying logins to the host I was able to steer the user to another host.


To list the users logged in and obtain their Session ID

query session

To log off a session

logoff <Session ID>

To list all processes and find the Session ID related

query process *

To list processes and obtain the PID (process ID)

tasklist

To end a process

taskkill /F /PID <PID>

To log a user off from another server

Logoff <SessionID> /server:<hostname>