#Code powershell to switch eSIM to sim on laptop
31 messages · Page 1 of 1 (latest)
How would you do it without PowerShell? Keep in mind that PowerShell is just a tool.
I know I can just do it in the settings, but I'd like to add it to a program I use to prepare laptops, but I can't get the code to work.
Fwiw this was on the main channel.
The question above is pertinent. Doesn't look like it's presenting as a PNP device, but that may also need a "in what operating system" follow-up.
Windows
then I'm kind of surprised it's not a PNP device. Start with "How do I do this in the OS"
and be aware that MS may not have bothered at all to present a publicly documented programmatic API for it.
I don't really understand what you're saying.
if you had to do it in the operating system without scripting it, how would you do it?
So I go to settings, then networks and internet, then cellular network and change eSIM to SIM.
hm you might have to watch it with process explorer or something to see if it's making an obvious change to the registry (or similar).
That isn't even an option on my computers so I can't even see what it looks like.
Anything to do with Settings is a bit of a mess though, it might be hard to track down.
give some screenshots
there are a couple powershell commands capable of altering network settings
but without seeing what you are actually changing its hard to guess
ok, windows 11 ... i have no way to check unfortunately. the only w11 vm i got, has no dropdown in any of its network devices
yeah my win 11 desktop doesn't have any such option, but it has no SIM cards / devices of any kind installed
Bruh
the Venn diagram for this one is poor. People who can figure out settings + people who can figure out MSs mess or translate that to powershell + people who have SIM cards in a windows system.
sorry for chatgpt answer:
Got it! If you want to switch between SIM and eSIM profiles using PowerShell, you can use the netsh command to manage network interfaces. Here's a basic example of how you might switch between profiles:
-
List Network Interfaces: First, list all network interfaces to identify the names of your SIM and eSIM profiles.
netsh interface show interface -
Disable Current Profile: Disable the current active profile (SIM or eSIM).
netsh interface set interface name="YourCurrentProfileName" admin=disable -
Enable Desired Profile: Enable the desired profile (SIM or eSIM).
netsh interface set interface name="YourDesiredProfileName" admin=enable
Replace "YourCurrentProfileName" and "YourDesiredProfileName" with the actual names of your SIM and eSIM profiles.
This script will disable the current network profile and enable the desired one. Make sure to run PowerShell with administrative privileges to execute these commands.
If you need more advanced control or automation, you might need to look into using the Windows Management Instrumentation (WMI) or other network management tools.
Would you like to explore more about managing network profiles with PowerShell?
ive been using netsh for similar stuff in the past. so there may be some truth to this. but its probably not exactly what you are looking for (standard chatgpt disclaimer)
if that works then Get-NetAdapter should show them too
Is not work
what does get-netadapter return. show that.
you can blur the mac if you want
Is this doc what you are talking about? https://learn.microsoft.com/en-us/mem/intune/configuration/esim-device-configuration#monitor-esim-profile-details-on-the-actual-device . seems strange to go from eSIM to SIM.
the cellular adapter has got to be in the get-netadapter output...i think...
oh try this script in this article. https://community.spiceworks.com/t/get-cellularadapter/974516