Linux (Restricted Features) | Windows (Full Features) | MacOS(Restricted Features) |
---|---|---|
I'm a researcher on Machine Learning, especially Deep Learning. In addition, I also do some software development.
For some specific reasons, I cannot directly develop on a traditional Linux server and have to use a workstation-level PC with Windows (Win11) and WSL2 to realize my daily work.
Using a shell for PC management is necessary for almost all developers. However, from what I was able to retrieve on the internet, it seems to assume a Linux and Bash
-based scenario for us, developers, in many PC management tutorials or examples, which is far different from my working situation.
This makes me feel lonely helplessness and have to go through Technical documentation | Microsoft Learn, trying to find a way to achieve my own goals.
As a consequence, I have to learn more about Windows development, especially PowerShell.
Referring to some examples of Linux and Bash
-based operations, I tried to migrate them to my everyday usage scenarios (Windows and PowerShell
-based). In the beginning, these were only some simple commands. Then, I merged them into scripts. Now, I think it's time to integrate them into a PowerShell module and share, which not only can help me to simplify my configure operations but also may help those who have similar working scenarios as me.
This customized PowerShell Module, PSComputerManagementZp
, derives from my scenarios, which can help users configure their Windows PCs easily to realize many useful operations. The main features that have been supported(opted) or remained to do(non-opted) are as:
- Set system-level proxy.
- Set shell (process) level proxy.
- Set/unset environment variables.
- Format path for both Windows and WSL2.
- Deal with authorization problems on the Windows file system.
- Set DDNS. (Only support Aliyun DDNS now)
Some features are also available on WSL2 and Linux.
There are two ways to install and use this module. Make sure your PowerShell version is 7.0 or later.
-
From source, with the latest version (maybe pre-release version):
git clone git@github.com:Zhaopudark/PSComputerManagementZp.git cd PSComputerManagementZp ./Scripts/install.ps1
-
From PowerShell Gallery, with the stable version:
Install-Module -Name PSComputerManagementZp -Force
If it has been installed already, just update:
Update-Module -Name PSComputerManagementZp -Force
-
From PowerShell Gallery, with the latest version(maybe pre-release version):
Install-Module -Name PSComputerManagementZp -Force -AllowPrerelease
If it has been installed already, just update:
Update-Module -Name PSComputerManagementZp -Force -AllowPrerelease
- May not be compatible with other software, CLI tools, CLI commands or PowerShell Modules. Such as, if you have enabled
system proxy
in some tools, there is no need to use the case Set IPV4 system proxy byLocalhost
withPortNumber
. - This module can modify the
User
andMachine
level environment variables in some cases, which should be noticed.
After installation of this module, you can realize many PC management operations easily. See the samples for more details and more samples.
Generally, the prerequisites are:
- Make sure your PowerShell version is 7.0 or later.
- Some cases need
Administrator
privilege.
The following is an example: Set system proxy IPV4 by Localhost
with PortNumber
.
Fundamental: Modify Current User
level registry items HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings
to set and unset system level proxy.
Note: ==This module is not a proxy tool, but a tool to help you configure the system level proxy. So, you should have a proxy server first.==
Please run PowerShell with Administrator
privilege.
Supposing the port number is 7890
, the following commands will automatically detect the IPV4 of localhost and then set the system proxy as 'localhost:7890':
#Requires -Version 7.0
#Requires -RunAsAdministrator
Import-Module PSComputerManagementZp -Scope Local -Force
$server_ip = Get-LocalHostIPV4
Set-SystemProxyIPV4ForCurrentUser -ServerIP $server_ip -PortNumber 7890
Remove-Module PSComputerManagementZp
Then, open Windows Settings->Network & Internet->Proxy
for checking:
Contributions are welcome. But recently, the introduction and documentation are not complete. So, please wait for a while.
A simple way to contribute is to open an issue to report bugs or request new features.
See Contribution Guide for more details.