Change Powershell default language code

How to create a profile

To create a profile for the current user in the current PowerShell host application, use the following command:

if (!(Test-Path -Path $PROFILE)) {
  New-Item -ItemType File -Path $PROFILE -Force
}

Then notepad $PROFILE to modify the profile file. Add the following line:

chcp 936
Create your code signing certificate
New-SelfSignedCertificate -CertStoreLocation cert:\currentuser\my `
-Subject "CN=Local Code Signing" `
-KeyAlgorithm RSA `
-KeyLength 2048 `
-Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" `
-KeyExportPolicy Exportable `
-KeyUsage DigitalSignature `
-Type CodeSigningCert
Open the Certificate Manager for Current User

From the same Powershell prompt, run:

certmgr /s my
Copy the new certificate to the appropriate cert stores

Expand the “Personal” folder, select Certificates. Right click the new Local Code Signing certificate, and Copy.

Paste into Trusted Root Certification Authorities and into Trusted Publishers stores.

Sign your Powershell script with the new cert

From a Powershell prompt, run these two commands:

$cert = @(Get-ChildItem cert:\CurrentUser\My -CodeSigning)[0]
Set-AuthenticodeSignature $PROFILE $cert

The above instructions is obtained from Microsoft Documentation About Signing and Profiles and from SpiceWorks.

Linyuan Shi
Linyuan Shi
Lecturer

My research interests include non-equilibrium reactive molecular dynamics simulation and first principles computation.