Windows simulate network cable loss - windows

I'm trying to program some tool and i want to simulate a network cable lose with it.
So i want to get the same effect like i unplug the networkcable from my computer and plug it in again. It's not the same as the '/renew' / '/release' commands. When i disconnect / connect it manualy it look likes windows remember some things and it's connected very fast back again.
Is it possible and maybe how to do it in code?
Thank you very much!
edit:
I found another program that just blocks all ports, this is ok for me too but how to do in code :).

You should set the fetch and send data bitrate to 0
Alternatively you could just set the receive bitrate to 0 bits and leave the send untouched this would also simulator the same.

Check out a great little tool called WANem . You can use it to simulate different WAN scenarios. Loss of connectivity is one possibility, but also jitter, noise and more on the line. Even simulating a dial-up connection. Runs as a bootable ISO and very easy to use.

Related

Is there a faster way to connect to a Bluetooth device from cmd/powershell than btcom from Bluetooth command line tools?

I've put together a Powershell script to allow me to connect my Bluetooth headphones to my PC without having to open the Bluetooth settings page each time (based on the ones in https://github.com/stanleyguevara/win10-bluetooth-headphones, but using Get-PnPDevice and Get-PnPDeviceProperty to check whether the device is connected rather than using an environment variable to save the state).
The script works, but there's one big QoL issue. The script uses the Bluetooth command line tools here to connect/disconnect the device (in particular, it uses the btcom command). However, these commands are very slow to run, with the whole process taking around a minute total. This is true even though I am using the device's MAC address to connect, and not its friendly name (which would be even slower). This makes using the script much slower than just opening the settings panel each time (though opening the settings panel is less convenient since it requires opening and going through multiple windows).
I've seen many questions about this sort of thing (how to connect/disconnect a Bluetooth device from cmd/powershell, but everything I've seen regarding Windows tends to suggest using the Bluetooth command line tools at the link above, so they don't solve the speed issue. Other things I've found suggest disabling the Bluetooth adapter entirely, which isn't what I want to do. Others suggest using the Win+K shortcut to open up the connections sidepanel, but this doesn't really address the question of whether there's a way to do this from cmd/powershell, and is slightly less automated since you have to wait a second for the list to populate and manually navigate to the device to connect/disconnect (though at least it solves the problem of opening a bunch of windows).
Is there a way to connect/disconnect from a Bluetooth device in cmd/powershell that is faster than btcom?

VBScript: how to write an event-driven script for checking if network cable has been unplugged?

I manage a lab with computers running Win XP Pro SP3. For a lot of reasons it is important that the network cable is always plugged in. Unfortunately some guys like to unplug the network cable: in this scenario when network cable is unplugged a shutdown command starts as a punishment for having unplugged it. At the moment I accomplish this using a VBS script starting when user logs in that acts like an infinite loop like this:
Do
WMI code for checking network status...
Loop
But in this case script is alway running and uses a lot of cpu pertentage. Now, it is possible in VBS to write a script that is able to "listen" an event like the disconnection?
Please don't advice to change programming language.
Thanks in advance for any help.
You're using a lot of CPU because you're constantly checking the status while this is not actually necessary - just put a sleep in your loop and set it to like 10 seconds.
Either way this is a very bizarre way of approaching the problem - why not just talk with your workers instead? Maybe there's a legitimate reason why they're unplugging the network?

Debugging stm32f4 via bluetooth

I'm rather unexperienced on the field of microcontrollers, I come from a Java background so the question might seem a bit noob but I didn't find much information on this.
So is it possible to debug an STM32F4 board via bluetooth (using eclipse or some othe IDE)? And if so could you send me some links that might help? We're building a robotic car controlled by a discovery board and debugging using an USB cable is not really an option if we don't want to disassemble the whole stuff every time something goes wrong. Hence this would really come in handy. So any help is appreciated
For doing this you would need to find a "Bluetooth Enabled" Debugger. I have never seen any and not sure whether there exists such thing or not.
I would suggest you one thing:
Assuming you have bluetooth connectivity between your board and your Machine,
Insert Debug strings: Send some strings from your board to your PC via Bluetooth. These strings will give you what's going on in Circuit.
For example, After Initialization, send "Init Completed" and like that. You can see these strings and see what's wrong.
I usually do this for my Wireless Device.
What you're wanting to do is really not practical; you're coming at this from way too high a level and trying to imagine the system as if it were running an operating system from the word go.
When you get the STM32 it as empty shell; you need to program it to do what you need to do and the only [sensible] way to get register-level debugging is to use a JTAG interface.
If, and this is a big if, you get it working reliably, but just want to give some debug information back while it is running, you could write a load of routines within the code to send out debugging messages when it enters certain parts of the program - and send it out over Bluetooth - but this is nothing like what you're used to single stepping through your Java code with Eclipse. If you want to do that kind of thing, you are going to have to put a little connector on that allows you to connect your JTAG or two-wire debugger cable to the processor. Even then, when you do that, you will be completely resetting your program and not simply single stepping through from where it went wrong.
You could insert a monitor program within your program to send out register values, program status etc over Bluetooth, but you still have to write the inital code and the only way to do this with out a ridiculous amount of trail and error is via your JTAG or two-wire interface.
Would this product work? It's a "IOGEAR Bluetooth Serial Adapter, GBC232A" for connecting to a serial port over bluetooth. I'm interested in wireless debugging too because my surface-clone dev computer only has one usb and this seems like it could be convenient over a tangle of usb cords and a usb hub. I have zero experience with any of this, so maybe you could validate or invalidate it as an option. I figure it just needs a proper serial connector wired up on the board and power from on-board?

SMS war continues, ideas welcome

I am trying to make U9 telit modem send SMS messages. I think I handle protocol correctly, at least, I manage to send them, but only under these circumstances: the native application was executed beforehand, and killed by task manager (without giving it a chance to initialize things).
It looks like the supplied application is good at doing certain initialization/deinitialization which is critical. I also see the difference between the two states in output of AT+CIND command. When I am trying to do things on my own, it returns zeroes (including signal quality), but when I run the same command after killing the native application, the output looks reasonable.
I am out nearly of ideas. I have tried many things, including attempts to spy at modem's COM ports (didn't work). Haven't tried setting windows hooks to see what the application is trying to get thru.
Perhaps you have encountered a similar situation?
Agg's "Advanced Serial Port Monitor" actually helped a lot. Sometimes it caused blue screen, but it helped uncover secret commands which seem to help. AT+PCFULL is not described anywhere on the net, for example. The real trigger of non-operatio was AT+CFUN, the power disable/standby feature.
Also, it appeared that we have more issues. At first, the modem appears on the bus only as disk drive. It doesn't want to appear as any other devices before the drivers are installed. So, the U9 Telit software sends an IOCTL to disk driver to tell the modem to reappear as more devices (modem, 3 serial ports, another disk drive).

Windows batch file to change monitor settings

I have a desktop computer that is hooked up to 3 different monitors of which only two can be active at any one time. One is a primary monitor and is always active. I can manually switch between the other two: one a monitor, another an HDTV.
The switch is a mechanical switch which only handles VGA (and at that, only the RGB components are actually switched) so there is no feedback to the computer from the other devices, thus windows can not make any automatic adjustments to change resolutions and things like that.
I want to make a batch file that will automatically switch the screen configurations and resolutions (hard coding the proper resolutions of course since we can't detect the other devices anyways) so that they are correct for the displays.
Where is the best place to get started? Where can I find library of commands (or whatever they are called) to do something like this? Lastly, is there anything I should be careful about when attempting something like this?
Thanks in advance,
-Faken
Try reschangecon (yes, there is a console version!).
It is safe, because it won't let you set settings that are not supported (without the force flag).
http://www.12noon.com/displaychanger.htm (It is free for personal use)
I've used ResSwitch to do this on my friend's HTPC that periodically forgot what resolution to drive his TV at, you call it like this: resswitch.exe 1920 1080 32 60
http://www.naughter.com/qres.html
The risk is it doesn't ask you to confirm, so you better be sure your monitor can handle the resolution you're asking for.

Resources