Showing posts with label Microsoft. Show all posts
Showing posts with label Microsoft. Show all posts

Monday, 9 December 2024

Understanding Microsoft SQL Index Fragmentation and How to Manage It

Introduction

Indexes in SQL Server play a crucial role in improving query performance by allowing faster access to data. However, over time, these indexes can become fragmented, leading to slower queries and increased system resource usage. In this post, we’ll explore what index fragmentation is, its types, and how to address it effectively.

What Is Index Fragmentation?

Index fragmentation occurs when the logical order of data pages in an index no longer matches their physical order on disk. This misalignment can cause SQL Server to work harder to retrieve ordered data, negatively impacting performance.

Types of Fragmentation:

  1. Internal Fragmentation:

    • Happens when data pages contain excessive free space, often due to page splits during inserts or updates.
    • Leads to inefficient use of storage and additional I/O operations.
  2. External Fragmentation:

    • Occurs when the logical sequence of pages doesn’t align with their physical storage order.
    • Results in extra effort for SQL Server to return ordered results.

When to Reorganize or Rebuild Indexes

To manage fragmentation, SQL Server provides two options:

  • Reorganize:
    • A lightweight, online operation that defragments the index at the leaf level by reordering pages.
    • Minimal system resource usage and can be safely interrupted.
  • Rebuild:
    • A more intensive process that completely recreates the index, removing fragmentation.
    • Can be done online or offline, depending on your SQL Server edition.
    • Requires more resources but provides thorough optimization.

Key Considerations for Online Index Rebuilds:

  • Enterprise Edition: Supports online rebuilds, allowing uninterrupted access to data.
  • Standard and Other Editions: Requires offline rebuilds, during which data access is temporarily restricted.

Best Practices

  • Reorganize when fragmentation levels are between 5% and 30%.
  • Rebuild when fragmentation exceeds 30%.

These thresholds may vary depending on workload and system specifics. Regular monitoring of fragmentation levels helps maintain optimal performance.

------------Code----------

SET NOCOUNT ON;

-- Create a temporary table for results
IF OBJECT_ID('tempdb..#Fragmentation') IS NOT NULL DROP TABLE #Fragmentation;

CREATE TABLE #Fragmentation (
    DatabaseName NVARCHAR(128),
    TableName NVARCHAR(128),
    IndexName NVARCHAR(128),
    IndexType NVARCHAR(60),
    AvgFragmentationPercent FLOAT,
    FragmentCount INT
);

-- Declare variables
DECLARE @DBName NVARCHAR(128);
DECLARE @SQL NVARCHAR(MAX);

-- Iterate through all databases
DECLARE dbCursor CURSOR FOR
SELECT name FROM sys.databases
WHERE state_desc = 'ONLINE' AND name NOT IN ('master', 'tempdb', 'model', 'msdb');

OPEN dbCursor;
FETCH NEXT FROM dbCursor INTO @DBName;


WHILE @@FETCH_STATUS = 0
BEGIN
    SET @SQL = '
    USE [' + @DBName + '];
    INSERT INTO #Fragmentation
    SELECT 
        DB_NAME() AS DatabaseName,
        OBJECT_NAME(ips.object_id) AS TableName,
        i.name AS IndexName,

        CASE 
            WHEN i.type = 1 THEN ''Clustered Index''
            WHEN i.type = 2 THEN ''Non-Clustered Index''
            WHEN i.type = 3 THEN ''XML Index''
            ELSE ''Unknown''
        END AS IndexType,

        ips.avg_fragmentation_in_percent AS AvgFragmentationPercent,

        ips.page_count AS FragmentCount

    FROM 
        sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, ''LIMITED'') ips

    JOIN 
        sys.indexes i ON ips.object_id = i.object_id AND ips.index_id = i.index_id

    WHERE 
        ips.avg_fragmentation_in_percent > 5

    AND 
        ips.page_count > 1;';

    EXEC sp_executesql @SQL;
    FETCH NEXT FROM dbCursor INTO @DBName;
END;

CLOSE dbCursor;
DEALLOCATE dbCursor;

-- Display results
SELECT * FROM #Fragmentation
ORDER BY DatabaseName, AvgFragmentationPercent DESC;

-- Clean up
DROP TABLE #Fragmentation;


Saturday, 17 August 2024

Windows Memory compression (More RAM at the expanse of CPU)

In its 10525 build, Windows 10 introduced a feature known as Memory Compression also included in Windows 11. This feature aims to optimize the utilization of your system’s physical memory and reduce the need for disk-based pagefile IO operations.

Memory Compression works by compressing infrequently accessed pages and retaining them in a new compression store within the physical RAM. This process allows your PC’s RAM to store more data than its original capacity, which can enhance your system's performance.

For instance, if your PC has 8 GB of RAM available, and there’s 9 GB of data to be stored on it, Memory Compression will attempt to compress the extra data so it fits within the 8 GB capacity of your RAM. Without Memory Compression, your PC would store the extra data in a file on your hard drive storage, which can slow down your PC as it takes more time to read data from a file on the hard drive than from RAM.

While Memory Compression can improve performance, it does use more CPU resources. If you notice a lot of compressed memory and think it’s slowing down your PC, there are a couple of solutions. One solution is to install more physical memory (RAM). This will allow your system to store more data in RAM without needing to compress it, reducing the CPU usage associated with Memory Compression.

If installing more RAM is not feasible, you can disable Memory Compression. Here’s how:

  1. Open the Command Prompt as an administrator.
  2. Type the following command and press Enter: `Disable-MMAgent -mc`
  3. Restart your computer.

In conclusion, Memory Compression is a feature designed to optimize your system's performance by making efficient use of your RAM. It's a tool that can be beneficial, but like all tools, it's important to understand how it works and when to use it.

Saturday, 8 July 2023

Using previous files in Windows to restore a file

Have you ever accidentally deleted a file or made changes to it that you regret? Fortunately, Windows has a built-in feature that allows you to restore previous versions of files. This feature is called "Previous Versions" and can be a lifesaver in situations where you need to recover lost data. In this guide, we will walk you through the steps to restore a file using previous versions in Windows.

Step 1: Accessing Previous Versions

The first step to restoring a file using previous versions is to access the feature. To do this, follow these steps:

1. Navigate to the folder that contained the file you want to restore.

2. Right-click on the file and select "Properties" from the context menu.

3. In the Properties window, click on the "Previous Versions" tab.

If you see the message "No previous versions available," it means that Windows does not have any previous versions of the file that you can restore.

Step 2: Selecting a Previous Version to Restore

Once you have accessed the Previous Versions tab, you will see a list of all the available previous versions of the file. Each version will have a timestamp indicating when it was created or last modified. Follow these steps to select a previous version to restore:

1. Select the version you want to restore from the list.

2. Click on the "Restore" button.

3. In the confirmation window, click on "Restore" again to confirm that you want to restore the selected version.

Step 3: Restoring the File

After you have confirmed that you want to restore the selected version, Windows will restore the file to its previous state. Depending on the size of the file, this process may take a few seconds or several minutes. Once the process is complete, you should see the restored file in the folder where it was originally located.

Thursday, 29 June 2023

Boost Your Productivity with Microsoft Edge Workspaces

Microsoft Edge Workspaces is an innovative feature that revolutionizes the way users organize their browsing tasks. Initially available as part of Microsoft 365, Edge Workspaces is now expanding its reach to personal use as well. In this blog post, we will explore the key features and benefits of Edge Workspaces, along with a brief guide on how to utilize this powerful tool.

What are Microsoft Edge Workspaces?

Edge Workspaces allow users to create dedicated windows for different projects or tasks, each containing its own set of tabs and favorites. It enables seamless collaboration and efficient organization of web resources, making it easier to stay on top of multiple projects or work with teams. Whether you're an individual professional or part of a larger organization, Edge Workspaces can significantly enhance your browsing experience.

Key Features and Benefits:

Streamlined Onboarding and Project Collaboration:

Onboarding new team members or working on projects with multiple teams becomes effortless with Edge Workspaces. Instead of sharing numerous links and files, you can create a workspace with all the relevant websites and working files, and simply share a single link. This ensures that everyone involved is on the same page, reducing confusion and improving productivity.

Personalized Organization:

If you find yourself juggling multiple projects simultaneously, Edge Workspaces allow you to create dedicated workspaces for each project. By organizing your open tabs based on projects, you can easily switch between workspaces and have all the necessary resources at your fingertips.

How to Use Microsoft Edge Workspaces:

Ensure Prerequisites:

To start using Edge Workspaces, make sure you have an Azure Active Directory (Azure AD) tenant and Microsoft Edge version 114 or later installed. For administrators managing workspaces via group policy, the corresponding versions of Microsoft Edge and policy files are required.

Enabling Edge Workspaces:

Edge Workspaces are enabled for users signed in with an Azure AD account on Microsoft Edge version 114 or later. Admins can manage Edge Workspaces for their users by utilizing the EdgeWorkspacesEnabled policy.

Creating and Sharing Workspaces:

To create a workspace, open Microsoft Edge and go to the Workspaces menu. Click on "Create new" and add the desired tabs and favorites to the workspace. Once created, you can share the workspace with team members by sending them the workspace link.




Collaboration and Real-Time Updates:

When users access a shared workspace, they can view the same websites and working files as their colleagues. Each member's active tab is visible to others, facilitating real-time collaboration. Any updates made to the workspace are reflected instantaneously for all users, ensuring seamless teamwork.

Note: Edge Workspaces for personal use is currently available as a preview. Visit the Edge Workspaces preview page for consumer accounts to learn more and join the preview program.

Friday, 9 June 2023

Enhancing Video Conferencing Experience with Microsoft Teams Avatars

In the fast-paced world of remote work and virtual meetings, video conferencing fatigue has become a common challenge. Microsoft Teams, a popular collaboration platform, has recognized this issue and responded with avatars. By introducing avatars as an alternative to turning on the camera during meetings, Microsoft Teams aims to provide users with more flexibility, increased comfort, and an added layer of choice.

One of the aspects of Microsoft Teams avatars is their ability to express emotions. Your avatar can convey a range of reactions during meetings, such as laughter, applause, and smiles. This feature adds a touch of personalization and engagement to the virtual meeting experience, making it feel more interactive and dynamic. By utilizing expressive avatars, participants can maintain a sense of connection and non-verbal communication even without turning on their video.

Getting started with avatars in Microsoft Teams is a quick and simple. install the Avatars app from the left side of Teams, and you're ready to dive in. Once you have the app up and running, you can unleash your creativity and customize your avatar across various categories like Body, Face, Hair, Appearance, and Wardrobe. It's like creating your own digital alter ego, reflecting your unique style and personality.

Ready to step into the spotlight without actually showing your face? Joining a meeting with your avatar is a seamless process. During a Teams meeting, just click on the More button at the top of the meeting window, the "Avatars and Effects" option is there. With a single click, you can switch from your camera to your avatar and enjoy the freedom of being video-free. It's perfect for those moments when you need a break or simply prefer a more relaxed vibe.

Let's talk about why avatars are not just a gimmick but actually bring benefits to the table. First and foremost, they alleviate video conferencing fatigue. No more worrying about how you look on camera or being conscious of your background – simply let your avatar take the stage. Avatars also offer a sense of privacy and anonymity, allowing you to feel more at ease during meetings. Plus, the expressive nature of avatars adds a playful and interactive element to the virtual space, making meetings a whole lot more enjoyable.

Microsoft Teams avatars are a game-changer for virtual meetings. They provide users with the flexibility to express themselves, personalize their virtual presence, and escape the burden of constant video visibility. By bringing a sense of fun and comfort to the meeting experience, avatars enhance engagement and communication. So, why not give avatars a try in your next Teams meeting and enjoy the benefits they bring?

Microsoft also offer admins control over this feature, in case its not a good fit for your company
Set up avatars for Microsoft Teams - Microsoft Teams | Microsoft Learn

Joining a meeting and creating you avatar
Join a meeting as an avatar in Teams - Microsoft Support

Wednesday, 22 March 2023

Quick Guide: Windows Quick Assist


When it comes to technical difficulties, remote assistance can be a lifesaver. Windows Quick Assist is one such feature that allows a user to remotely access another Windows computer to resolve issues. Here's a quick guide on how to use Windows Quick Assist.

To use Quick Assist, both the user who needs assistance and the person who will provide it must sign in to Quick Assist. To launch Quick Assist, open the Start menu, enter "Quick Assist," then select it from the results. Alternatively, press the Windows key and Ctrl and Q simultaneously.

If you use the key presses and do not have Quick Assist installed it will pop up and as if you want to get from the store.

https://www.microsoft.com/store/productId/9P7BP5VNWKX5

Once you have Quick Assist open, enter the six-digit code provided by the other person in the "Code from assistant" box, then click "Submit." If you're the one providing assistance, you can share your screen by selecting "Allow."

Windows Quick Assist is an easy-to-use feature that can be a lifesaver when you're dealing with technical issues. Whether you're providing assistance or receiving it, Quick Assist can help you resolve problems quickly and efficiently.

Use Quick Assist to help users - Windows Client Management | Microsoft Learn

Wednesday, 8 March 2023

Windows Insider: Canary Channel

Microsoft has introduced a new update channel for Windows Insiders called the "Canary Channel." This channel will provide the earliest access to new Windows builds almost daily, but it comes with the risk of more bugs and instability.

The Canary Channel is intended for developers, early adopters, and advanced users who want to test new features and provide feedback to Microsoft. The company plans to release new builds to the Canary Channel every day but will be starting slowly and building up the schedule , making it the fastest way to get access to new features and improvements.

However, Microsoft are warning that the builds released in the Canary Channel are not be stable and may contain bugs that could affect system performance, Therefore, it is recommended that users only install these builds on test machines or in virtual environments.  

But those currently subscribed to the Dev Channel will be moved to the Canary Channel automatically which is why Microsoft are recommending you check the insider channels you are on.

If you are an Insider in the Beta Channel who wants to be closer to the latest new features and experiences, we recommend you switch to the Dev Channel today.

It is important to note that when switching channels, Insiders can’t switch to a channel that is receiving builds with lower build numbers without doing a clean installation of Windows 11 due to technical setup requirements.

Meaning if you do not check now and you need to switch later you will need to reinstall Windows again.

What’s coming for the Windows Insider Program in 2023 | Windows Insider Blog


Tuesday, 28 February 2023

Windows UAC and Local admin rights


User Account Control (UAC) is a security feature in Windows that helps prevent unauthorized changes to your computer. It was introduced in Windows Vista and has been an important security mechanism in all versions of Windows since then. UAC works by prompting the user for permission before allowing any action that requires administrative privileges.

UAC is an important security mechanism in Windows that helps protect your computer from unauthorized changes and malware. Turning off UAC is not recommended and can make your computer vulnerable to attacks. It is always better to keep UAC enabled and take extra precautions to protect your system from potential threats

But when it comes to local admin rights even with UAC enabled you should still split these local rights to another account.  A users everyday account should have little to no extra permissions then want is needed for the everyday work they do.

But they are times when having these rights are a positive as it gives users flexibility and faster response to install software and updates without the need of IT support, this brings more user autonomy and lowers the involvement of IT support.

Given a user a local admin account just for admin tasks while also maintaining a normal account is the best of both words when it comes to user autonomy and security.

Friday, 24 February 2023

Windows 10/11 Hybrid Boot (Fast Boot) - Why rebooting is better then shutting down to fix an issue


When you choose to shut down your Windows 10 or 11 system, it actually goes into a hybrid boot mode. This means that your system saves some information in a special file on your hard drive and then turns off most of its components to conserve power. When you turn your system back on, it quickly reloads that information and wakes up from this hybrid mode. This process is faster, so makes the system feel quicker on start-up 

On the other hand, when you choose to reboot your Windows 10 or 11 system, it completely powers down and then starts back up again from scratch. This means that any temporary files or processes that were open before the reboot will be closed and the system will start fresh. Rebooting your system is a good way to refresh it and make sure any updates or changes are properly applied.

So, if you want to completely power down your Windows 10 or 11 system and start fresh, choose the "Restart" option.

Thursday, 23 February 2023

Windows 11 22H2 Moments 2 update


 Microsoft has pushed its latest build to the Insider program and its expected to be released fully in March.

The first feature drop, Moment 1, was released in October 2022 and introduced new experiences such as Android app support, Teams chat integration, widgets personalization, snap layouts improvements, and more.

This feature release will bring more enhancements and capabilities to Windows 11 users, such as:


  • Windows Studio effects: This feature allows users to access various effects for their camera and microphone directly from quick settings on the taskbar. Users can apply effects such as background blur, portrait lighting, voice enhancement, noise cancellation, etc. to improve their video calls or recordings. This feature requires a device that has a supported neural processing unit (NPU).

  • Energy Recommendations: This feature helps users optimize their battery life by providing personalized recommendations based on their usage patterns and device settings. Users can access these recommendations from Settings > System > Battery > Energy Recommendations.

  • Touch-optimized taskbar: This feature improves the tablet experience on Windows 11 by introducing a new taskbar design that automatically transitions to tablet mode when disconnecting or folding the keyboard on a convertible device. The taskbar offers two modes: collapsed and expanded. In collapsed mode, the taskbar shows only icons for pinned apps and quick settings. In expanded mode, the taskbar shows labels for pinned apps and additional buttons for Start menu, Task View, Search box, etc.

  • Improved system tray: This feature updates the system tray icons to match the new design language of Windows 11. It also adds new icons for Focus assist and Nearby sharing.

  • Other features: Moment 2 will also include other features such as improved File Explorer context menus with Fluent design elements; updated emoji picker with skin tone selector; redesigned Snipping Tool app with modern UI; improved touch keyboard with swipe gestures; revamped Microsoft Store app with more content and categories; etc.

Thursday, 16 February 2023

Bing AI Going Live: What You Need to Know

 Bing, Microsoft's search engine, has been around since 1998, but it has never been as smart and conversational as it is now. Thanks to a partnership with OpenAI, the company behind ChatGPT, Bing has been upgraded with artificial intelligence that can chat with you and help you find what you need on the web.

The new Bing features a chat box rather than a search box, and you can talk to it like a person using natural language. For example, you can ask Bing for recommendations, tips, facts, jokes, stories, or anything else that comes to your mind. Bing will try to answer your questions or guide you to relevant web pages using its ChatGPT-powered copilot feature[^1^][1] [^2^][2].

The new Bing also has contextual searches that can understand what you are looking for based on your previous queries and conversations. For instance, if you ask Bing about movies and then say "show me the trailer", it will know that you want to see the trailer of the last movie you mentioned[^3^][3]. This way, you don't have to repeat yourself or type long queries.

The new Bing is not only smarter but also more fun and engaging. It can tell you jokes, stories, poems, riddles, trivia, and more. It can also generate creative content such as lyrics, tweets, essays, code snippets[^4^][4], etc. You can even play games with Bing such as tic-tac-toe or rock-paper-scissors[^5^][5].

The new Bing is currently available in a limited preview for desktop users who sign up for it on Microsoft's website[^2^][2]. Users will get a limited number of queries to search during the initial period. Microsoft plans to roll out the new Bing to more users and devices in the coming months.

If you want to try out the new Bing for yourself and see how it compares to other search engines such as Google or ChatGPT itself[^3^][3], head over to https://www.microsoft.com/en-us/bing/new-bing-preview/ and sign up for an invitation. You might be surprised by what Bing can do for you.

Sources

  1. https://bing.com/search?q=Bing+AI+going+live
  2. https://www.windowscentral.com/news/live/microsoft-special-event-live-blog-windows-bing-ai-2023
  3. https://www.cnbc.com/2023/02/07/microsoft-open-ai-chatgpt-event-2023-live-updates.html
  4. https://www.windowscentral.com/software-apps/users-show-microsoft-bings-chatgpt-ai-going-off-the-deep-end
  5. https://www.windowscentral.com/software-apps/users-show-microsoft-bings-chatgpt-ai-going-off-the-deep-end
  6. https://www.reuters.com/technology/how-get-microsofts-new-ai-enhanced-bing-2023-02-07/
*Notes*
This was written by Bing AI,  that is awesome and scary at the same time.

Friday, 25 November 2022

Outlook prompts with a basic login box when an application tries to send an email via MAPI with the applications exe name (Enter1) in the login title information

 1. Remove all stored credentials under "Manage Credential Manager" > "Windows Credentials" relating to Outlook

2. Delete all Outlook Profiles

3. Delete

   - HKLM\Software\Microsoft\Office (Need to take ownership of some of the folders)
   - HKCU\Software\Microsoft\Office
   - HKCU\Software\Microsoft\Exchange

4. Run a repair of office

5. Reboot device

6. Set up Outlook and make sure modern auth pops

7. Set cache to 6 months

8. Leave it for a few mins

9. Reboot

10. Open Outlook

11. Test
*Outlook needs to be open when sending.

Friday, 2 September 2022

Microsoft Edge Side bar

 Microsoft has added a new sidebar to its Edge browser which allows you to discover related items on the site you are visiting, access to some tools a little easier, access your office applications, your emails, and also panic you in to thinking you have a browser hijacker when it magickly enabled itself for the first time.

It's actually growing on me the more I explore it but still.

If you wish to remove it you can press Control + Shift + / or press the following button on the side bar itself




It also a toggle just below the settings option too (3 dots) at the top right



Friday, 24 June 2022

Triggering Intune Management Extension (IME) Sync

If you need to trigger Intune Management Extension you can run the following with the user context

intunemanagementextension://syncapp

If you wish to do it via powershell

$Shell = New-Object -ComObject Shell.Application
$Shell.open("intunemanagementextension://syncapp")

More details found here 

Wednesday, 1 June 2022

Find which Windows program is accessing a external device like a web cam

  1. You need the devices "Physical Object" name, you get this by doing to "Device Manager" and double clicking on the device and switching to the details tab.

    From there you can use the drop down box and select "Physical Object", right click on the value and select copy.

  2. You will need Process Explorer for this part.  you can get it from the following location:

    Process Explorer - Windows Sysinternals | Microsoft Docs

  3. Run Process Explorer as administrator and then go to Find and select "Find Handle or DLL"

  4. Paste in the "Physical Object" name from step 1 and press search.

    You will need to give it a few minutes as it can be slow.
Once its listed the process you can see if its being accessed by programs you where expecting of it something else is going on.

Thursday, 14 April 2022

Microsoft Excel 2016 - Can not right click and cut or paste, greyed out

Seen this happen on an Remote Desktop,  fix was to delete \ rename the xlb file located in "\AppData\Roaming\Microsoft\Excel"

That should fix it.  but also had to just rename the whole folder / delete it and that sorted it too.

Thursday, 18 February 2021

Windows Administrative shares

 By default Windows automatically makes the following shares

ADMIN$
IPC$
NETLOGON
SYSVOL
PRINT$
FAX$
DRIVELETTER$

These are administrative shares and are they to help with the remote admin / function of a server.  Normally only admins can access these.  But sometimes if you are trying to meet a security compliancy you will need to disable these on workstations and some server.

You can do this by changing the following reg key 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\AutoShareServer

To 0 (Zero) and if its not there you will need to make a REG_DWORD and set it to 0 (Zero)

Remove administrative shares - Windows Server | Microsoft Docs

Ideally I would leave them be; as they do come in handy and the client / server should have firewalls configured to limit risk.

Thursday, 21 January 2021

Clear your cache in Microsoft Edge

 When in Edge press Ctrl, shift and del and it will take you straight to the opinion.  

Or you can go to the 3 dots in the top left followed by settings, then "Privacy, search, and services".  where you will see a button called "Choose what to clear"


Tuesday, 13 October 2020

Windows 10 Network Connection Status Indicator (NCSI)

 The Network Connection Status Indicator within Windows 10 makes a call to the following URL

http://www.msftncsi.com/ncsi.txt
http://www.msftconnecttest.com/connecttest.txt

Depending on the response it will tell you if you have internet, need to login to access the internet, or have no internet.

Sometimes firewalls can block or filter this request  leading to issue with workstations.  If your not using a login portal for users internet access and are getting issues with devices reporting no internet the first check would be to bypass the URL and allow it straight out.

Friday, 9 October 2020

Windows Account Lockout policy

 When setting up the Windows networks with account lockouts for failed logins I would recommend a 10/10/60 as a baseline

10 Failures over 10 minute with a 60 minute lockout.  the lockout can be longer but I found going lower on the other values can lead to accounts getting locked for Kerberos ticket failures when people leave them self's logged in.

https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/account-lockout-threshold