Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Sunday, April 20, 2025

Run windows apps through Wine emulator on Mac OS Apple Silicon

 https://macappstore.org/whiskey/ 

About the App

Install the App

  1. Press Command+Space and type Terminal and press enter/return key.
  2. Copy and paste the following command in Terminal app:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 
    and press enter/return key. Wait for the command to finish. If you are prompted to enter a password, please type your Mac user's login password and press ENTER. Mind you, as you type your password, it won't be visible on your Terminal (for security reasons), but rest assured it will work.
  3. Now, copy/paste and run this command to make brew command available inside the Terminal: echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
  4. Copy and paste the following command:
    brew install --cask whiskey

Done! You can now use Whiskey.

Refer this video on the steps to use the app on Mac OS Apple Silicon laptops

https://www.youtube.com/watch?v=8KeES5llh9I&t=82s 


Tuesday, November 8, 2022

How to use WMI from a .NET Application

To start with, let us see what is WMI and what it offers. WMI is an acronym for Windows Management Instrumentation, which is basically an interface to the Windows OS system settings, drivers, and parameters. It also allows managing Windows personal computers and servers through it.

A .NET developer can use WMI to obtain information about drivers installed on the client machine, verify whether the system is licensed or not, check for hardware configuration and a lot more.

Quoting Linus Torvalds, “Talk is cheap. Show me the code”, let’s get to the basics of WMI usage. To get data through WMI, a SQL-like query is used. The specific query type is called WQL (WMI Query Language). Don’t let the name confuse you. It is still very similar to SQL.

Before diving into code, you should know that Windows comes with a tool called WMI Test Tool, which lets you test WQL queries, to check their correctness and returned results. It is a bit harder to track wrong query results in code, so this tool can save some time for the developer. To run it, just start the Run dialog (or the Command Prompt) and type wbemtest.

Once it is started, you will see a window like this:


Click on Connect and you will see a dialog like this:




It lets you connect to a namespace on your local Windows computer. You can use your credentials (although for most queries this is not a requirement) and select the impersonation and authentication levels (once again, for most queries the default settings are acceptable). Once you click connect, you will be able to execute WMI queries, as well as perform other tasks (for example, enumerate classes in a superclass to review its possibilities).

Before creating a query, you need to understand what information you want to obtain. The query is executed against a WMI class – you can read the complete list here. Let’s take the Win32_Processor class as an example here. Querying against this class will give us information about the CPU installed on a machine. If the machine runs with multiple CPUs, a query result will be returned for each one of them.

The Win32_Processor class exposes the following properties:
AddressWidth
Architecture
Availability
Caption
ConfigManagerErrorCode
ConfigManagerUserConfig
CpuStatus
CreationClassName
CurrentClockSpeed
CurrentVoltage
DataWidth
Description
DeviceID
ErrorCleared
ErrorDescription
ExtClock
Family
InstallDate
L2CacheSize
L2CacheSpeed
L3CacheSize
L3CacheSpeed
LastErrorCode
Level
LoadPercentage
Manufacturer
MaxClockSpeed
Name
NumberOfCores
NumberOfLogicalProcessors
OtherFamilyDescription
PNPDeviceID
PowerManagementCapabilities[]
PowerManagementSupported
ProcessorId
ProcessorType
Revision
Role
SocketDesignation
Status
StatusInfo
Stepping
SystemCreationClassName
SystemName
UniqueId
UpgradeMethod
Version
VoltageCaps

Most of these are have self-descriptive names, but if you are ever confused about one of them, you can always refer to the MSDN documentation for the class, that explains each one of them.

Now, let’s try to get the values of the above mentioned properties in your .NET application. In my examples I am using C#, but if you are using another .NET language, you shouldn’t have a problem adapting the code.

First, you need to add a reference to the System.Management and System. Management.Instrumentation namespaces. This is done by right-clicking on References in the Solution Explorer and selecting Add Reference. Then, you can select the above mentioned libraries from the .NET list:



Once selected, you need to reference the proper namespaces in your code:using System.Management;
Now, to the actual code. I am going to create a function that can be called from anywhere in the code to simplify this task.void GetCPUInfo()
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject obj in searcher.Get())
{
if (!(obj == null))
Debug.Print(obj.Properties["CpuStatus"].Value.ToString());
}
}


The ManagementObjectSearcher is the key element here – it gets the returned properties based on the query. The parameter I am passing to it when instantiating is the actual query. As you see, it is very similar to SQL. My current query will retrieve all properties available in Win32_Processor. I iterate through them (note that each result is a ManagementObject – the property holder, in this case will be a separate instance for each CPU that is found) and print in the Output window the value of the CpuStatus property:



The 1 here is exactly what is returned. It is a good practice to consult the documentation before reading specific properties, to understand the possible returned values. 1 for CpuStatus means that the CPU is installed and is active.

Important note: Some of the readers might be curious, why there is a null value verification. Some of the classes require user authentication to get the correct data and some properties are simply not available, being the cause of multiple exceptions, depending on the authentication methods and property types. Therefore, to avoid exceptions, this code security measure is used here.

If only one property is needed to be retrieved, then the query can be organized like this:SELECT CpuStatus FROM Win32_Processor


The important thing to remember here is that when you only retrieve one property, the rest of them are unavailable for that specific query result. Therefore, trying to get their value will cause an exception.



Courtesy: Original source is from Denzel D at - https://dzone.com/articles/how-use-wmi-net-application

Friday, May 21, 2021

How to install touchpad driver for HP laptops to enable finger swipe gestures and bitlocker recovery

If your HP laptop has a precision touchpad functionality but the finger swipe gestures such as 2 finger scroll up down or th 3 finger app switching are not working, follow the below steps:

1. Visit the below HP official website and select the appropriate laptop model

https://support.hp.com/in-en/drivers/selfservice/hp-elitebook-840-g5-notebook-pc/8491271 






2. Navigate to the above driver selection at Driver-Keyboard, Mouse and Input Devices & hit the download button for the Synaptics Touch fingerprint driver. Install the driver and restart your laptop.

3. In case your Windows Operating system disk drives are bitlocker encrypted, you will reach the bitlocker recovery screen since the driver configuration of your system has changed. DO NOT PANIC !! Visit the custom URL seen on your laptop screen to access the recovery key for your laptop in the Microsoft site custom URL. Enter the recovery key and you should be able to successfully log in to your Windows desktop console.


Notice that the finger swipe gestures are now functional.

4. Configure the Precision Touchpad as per your preference here:



More details about bitlocker recovery  

https://docs.microsoft.com/en-us/windows/security/information-protection/bitlocker/bitlocker-recovery-guide-plan 

Wednesday, February 3, 2021

Hack for knowing your forgotten wifi password on your Windows PC/laptop

If you want to find out the password of your wifi connection connected to the internet in your system, type the below command in the command prompt and check the value of the property "Key content" !!

Voilaa... Your wifi password is now shown up on the response on the CLI on your windows PC/laptop screen :)

Disclaimer: Use it to find out the forgotten password of your own internet connection. Do not use it to hack into somebody else's wifi connection :D

C:\>netsh wlan show profile name=<wifi-name> key=clear


Profile <wifi-name> on interface Wi-Fi:

=======================================================================


Applied: All User Profile


Profile information

-------------------

    Version                : 1

    Type                   : Wireless LAN

    Name                   : <wifi-name>

    Control options        :

        Connection mode    : Connect automatically

        Network broadcast  : Connect only if this network is broadcasting

        AutoSwitch         : Do not switch to other networks

        MAC Randomization  : Disabled


Connectivity settings

---------------------

    Number of SSIDs        : 1

    SSID name              : "wifi-name"

    Network type           : Infrastructure

    Radio type             : [ Any Radio Type ]

    Vendor extension          : Not present


Security settings

-----------------

    Authentication         : WPA2-Personal

    Cipher                 : CCMP

    Authentication         : WPA2-Personal

    Cipher                 : GCMP

    Security key           : Present

    Key Content            : <password in clear text>


Cost settings

-------------

    Cost                   : Unrestricted

    Congested              : No

    Approaching Data Limit : No

    Over Data Limit        : No

    Roaming                : No

    Cost Source            : Default


Monday, December 7, 2020

Prerequisites for using VMs through Oracle VM Virtualbox Manager

If you need to utilize Oracle VM Virtualbox Manager, on your Windows Operating system, there are certain prerequisites that you will need to confirm. If these are not as per the below output, then your Oracle VM Virtualbox Manager might fail to start.

Open Windows PowerShell prompt and type the below 2 commands & verify that their output should be as below.

Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.


Loading personal and system profiles took 16318ms.

(base) PS C:\Users\rupakuma> Wmic computersystem get hypervisorpresent

HypervisorPresent

FALSE


(base) PS C:\Users\rupakuma> wmic cpu get virtualizationfirmwareenabled

VirtualizationFirmwareEnabled

TRUE

If not, you will need to enable virtualization through BIOS & disable Hyper-V in your Windows operating system.

Featured

TechBytes on Linux

This is a growing list of Linux commands which might come handy for the of Linux users. 1. Found out i had to set the date like this: ...

Popular Posts