Add readme.md
This commit is contained in:
commit
0450c17836
138
readme.md
Normal file
138
readme.md
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
# ip-settings.ps1 — LAN Network Profile Configurator
|
||||
|
||||
A PowerShell script for quickly switching a Windows network adapter between predefined static IP profiles or DHCP. Designed for situations where you need to connect to devices on different subnets — such as cameras, PLCs, or other industrial equipment — without manually digging through Network Settings every time.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- Auto-detects all physical network adapters and shows their current status, mode (DHCP/Static), and IP address
|
||||
- Lets you pick the adapter interactively by number
|
||||
- Applies one of two pre-configured static IP profiles or switches back to DHCP
|
||||
- Verifies and displays the new IP after applying
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
- Windows 10 / Windows 11
|
||||
- PowerShell 5.1 or newer (pre-installed on all modern Windows systems)
|
||||
- **Administrator privileges** (required to change network settings)
|
||||
|
||||
---
|
||||
|
||||
## First-Time Setup
|
||||
|
||||
If you have never run a local PowerShell script before, you may need to allow script execution once:
|
||||
|
||||
```powershell
|
||||
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## How to Run
|
||||
|
||||
**Option A — Right-click**
|
||||
Right-click `ip-settings.ps1` → **Run with PowerShell**
|
||||
> Note: this may not run as Administrator. If the script exits with an admin warning, use Option B.
|
||||
|
||||
**Option B — Administrator PowerShell (recommended)**
|
||||
```powershell
|
||||
# Open PowerShell as Administrator, navigate to the script folder
|
||||
cd C:\Users\Dejan
|
||||
.\ip-settings.ps1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Usage Walkthrough
|
||||
|
||||
### Step 1 — Select your adapter
|
||||
|
||||
The script lists all physical network adapters found on the system:
|
||||
|
||||
```
|
||||
Available Network Adapters:
|
||||
|
||||
[1] Ethernet Status: Up Mode: DHCP IP: 192.168.1.100
|
||||
[2] Ethernet 2 Status: Disconnected Mode: Static IP: 192.168.178.22
|
||||
|
||||
Enter adapter number: 1
|
||||
```
|
||||
|
||||
### Step 2 — Choose a profile
|
||||
|
||||
```
|
||||
Profiles:
|
||||
[1] Camera Control -> 192.168.178.22 /24 GW: 192.168.178.1
|
||||
[2] LAN Profile 2 -> 192.168.1.222 /24 GW: 192.168.1.1
|
||||
[3] DHCP (automatic)
|
||||
|
||||
Enter profile number: 1
|
||||
```
|
||||
|
||||
### Step 3 — Done
|
||||
|
||||
The script applies the settings and confirms the new IP:
|
||||
|
||||
```
|
||||
[OK] Camera Control applied -> 192.168.178.22/24 GW: 192.168.178.1
|
||||
[..] Verifying new config...
|
||||
|
||||
Current IP : 192.168.178.22/24
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## IP Profiles
|
||||
|
||||
| Profile | IP Address | Subnet Mask | Gateway | Use Case |
|
||||
|---|---|---|---|---|
|
||||
| **Camera Control** | 192.168.178.22 | 255.255.255.0 (/24) | 192.168.178.1 | Camera / device control network |
|
||||
| **LAN Profile 2** | 192.168.1.222 | 255.255.255.0 (/24) | 192.168.1.1 | Local area network |
|
||||
| **DHCP** | Automatic | Automatic | Automatic | Standard office / home network |
|
||||
|
||||
---
|
||||
|
||||
## Customizing Profiles
|
||||
|
||||
To change the IP addresses, subnet, or gateway — open `ip-settings.ps1` in any text editor and find these lines:
|
||||
|
||||
```powershell
|
||||
# Profile 1 - Camera Control
|
||||
$newIP = "192.168.178.22"; $prefix = 24; $gateway = "192.168.178.1"
|
||||
|
||||
# Profile 2 - LAN Profile 2
|
||||
$newIP = "192.168.1.222"; $prefix = 24; $gateway = "192.168.1.1"
|
||||
```
|
||||
|
||||
Edit the values and save. No other changes needed.
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**"Please run this script as Administrator!"**
|
||||
Open PowerShell by right-clicking the Start button → **Terminal (Admin)** or **Windows PowerShell (Admin)**.
|
||||
|
||||
**"running scripts is disabled on this system"**
|
||||
Run this once in PowerShell:
|
||||
```powershell
|
||||
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
```
|
||||
|
||||
**No adapters listed**
|
||||
Make sure at least one physical (non-virtual) network adapter is present and visible in Device Manager.
|
||||
|
||||
**IP not applied after DHCP switch**
|
||||
DHCP can take a few seconds. Wait a moment and check with:
|
||||
```powershell
|
||||
ipconfig /all
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Author
|
||||
|
||||
Configured for Dejan's workstation — Camera Control & LAN switching utility.
|
||||
Loading…
Reference in a new issue