powershell,batch-file,registry,windows-7-x64,regedit , Change OS Language Silently (Windows 7)

Change OS Language Silently (Windows 7)


Tag: powershell,batch-file,registry,windows-7-x64,regedit

I'm writing a script (powershell) for SQL Server 2014 Express Install. The problem is: I have to change the OS Language (Region and languages) to fr_FR (French from France) Silently. The current language is fr_CA (French from Canada).

My question is: Can i change the language from intl.cpl (Region and languages) with a batch file or command line or just from the register?

Thank you


didn't work for me but i found a solution to my problem.

I use a XML file to change properties by executing : control.exe intl.cpl,,/f:"c:\Unattend.xml" in CMD.exe as Admin

Here is my XML file :

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
    <gs:User UserID="Current"/>
  <!-- user locale -->
     <gs:Locale Name="fr-FR" SetAsCurrent="true" ResetAllSettings="false">            

Thanks for helping


batch result me “echo off” instead the proper result

I have a little problem with the next code @Echo off Title STARTING cls echo. echo Checking running services... echo. timeout /t 2 /nobreak >NUL tasklist /fi "imagename eq cmd.exe" /v | find /I /N "DATABASESERVER" >NUL if "%ERRORLEVEL%"=="1" ( cls echo. echo Database is not running, now will start!...

Send email with body consisting of objects

I am trying to write a script to search through AD and look for any stale computers and then sends an email to me. However, there are 3 requirements: get the lastlogondate for any pc that is older than 90 days once I get that list, I do a ping...

Loop Issue - Remote Server

I wrote a small script to get some basic information off a few remote servers. But my output it is a bit odd. I believe my issue is with my $DRIVE function. Code: $serversList = 'svr01.xxx.com', 'svr03.xxx.com', 'svr05.xxx.com', 'svr06.xxx.com', 'svr08.xxx.com' #End of Server List Write-Output "Start of Hal0 `n"; ForEach...

Get list of files whose creation date is greater than some date time

I have a date 2015/05/28 I want to list all files using order by creation date whose creation date is greater than that using PowerShell. How could I do that? I googled for it and found Get-ChildItem "C:\Users\gerhardl\Documents\My Received Files" but no idea how to compare it with creation date...

How do I write a loop to read text file and insert it to the database

I'm writing a powershell script to load text files from a specific folder into SQL server database, I have manage to do so but only one file by one file. I want the program to do this automatically once the user inputs the path and the file extension. For example:...

Getting Respond Time from Ping Command

I'm trying to create a batch file that will ping a certain server and will only display the respond time. I don't mind if value is stored in a variable or not. If you do a normal ping you get: Reply from <hostname/server>: bytes=#byte_value time=#time_value TTL=#TTL_value And I only want:...

How to show the place and only the words found Findstr?

I wonder how do I show the location where the words were found in findstr? My Code: Set "LFiles=%temp%\Files\*.txt">nul 2>&1 Findstr /li /G:"List.txt" "%LFiles%">"Result.TxT" (for /F %%a in (List.txt) do ( Findstr /li /C:"%%a" "%LFiles%" > NUL if not errorlevel 1 echo %%a ))>"Result2.TxT" List: Disc Music Song Album Result:...

Extract e-mail from grouped objects

I have some code that pull user accounts from an OU in AD. I am sorting it using Group-Object so I know how many users are using the same email address. Code below, the $OuUser uses Get-ADUser with Properties and Filter set to *. $Duplicates = $OUUser | Select samaccountname,...

PS pipe WorkingSet as variable

I have this which gives me the WorkingSet memory usage I'm after: $mem=Get-Process spiceworks | Select-Object Name,@{Name='WorkingSet';Expression={($_.WorkingSet/1KB)}} But I'm looking to only have the actual amount as the variable so I can then work with that to monitor it. I want to set it so it alerts me if it...

Get IP address of the Network Adapter of a computer having No gateway

I've a project to add persistent routes on a list of servers which I need to do through Powershell. Our environment has 2 NIC's for every server , one production one backup. For this I need to fetch the Backup IP address of the computer , replace the last octet...

PowerShell logic to remove objects from Array

I'm trying to remove objects from an array that contain duplicates and only keep the ones with the highest number in TasteCode. The example below is highly simplified, but it shows the problem. Example: $Fruits Name | Color | TasteCode ----- ------ --------- Apple | Red | 2 Apple |...

Convert batch command to python

I am trying to convert a .bat file to python, almost everything is working fine, only the compression part is not working, I point out the flags and the path to the "rar.exe", but it's not working at all in the python version. What I need to correct to have...

Search for certain UPN suffix

How do I search AD users by UPN suffix in AD? The users are under Uofguelph/SEC213/users OU. Some users have @sec213.com suffix and some have @home.sec213.com suffix. I need to search for users who only have @sec213.com suffix. I have the following two code snippets. Code 1 gets all accounts...

Execute a batch file before executing in a shortcut (.lnk)

I have multiple versions of a program called Siemens NX. NX uses environmental variables for configuration. I need NX 10.0 to use a different set of environmental variables than my NX 7.5 which uses the system environmental variables. Therefore, I have written a batch file that setups the environmental variables...

Increment Serial Number using EXIF

I am using ExifTool to change the camera body serial number to be a unique serial number for each image in a group of images numbering several hundred. The camera body serial number is being used as a second place, in addition to where the serial number for the image...

bat file script to check if string contains other string

I need to write a batch file that will check if a variable contains specific value. I tried to do the following: If "%%a"=="%%a:%pattern%" ( echo Yes ) else ( echo No ) input example: %%a="bob binson" %patern%="binson" I never get Yes printed! can anyone please tell what i missed...

Color a cell on the basis of another cell value

I have a file output.txt having below content: SERVER_NAME MOUNT_POINT TOTAL_SPACE USED_SPACE USED_PERCENTAGE AVAILABLE_SPACE Server_1 /dev 1200G 537G 54% 464G Server_2 /dev 600G 490G 85% 94G Server_3 /dev 600G 402G 69% 181G Backup_server /storage 800G 682G 72% 278G Using following script, I formatted my output.txt file to get a notification...

String manipulation with batch scripting

I need to save the variable in %%c temporarily which comes from a for loop. But when I try to do that, the content changes unexpectedly. Some space characters appear at the end of the string. The content of %%c is a.jpg by the way. echo %%ca REM prints a.jpga...

Batch script ends after for loop

I've got a batch file that executes a program along with sequential (numbered) macros and calls another batch file that monitors when it is finished before it begins the next iteration. I can't use Start /wait or other "ordering" commands when launching the program because it is started with a...

Passing argument to python script within a batch file in Windows

I have a python script that can be called in Windows as: python.exe do_my_work.py param > output.csv param is an input parameter. I also have a txt file called params.txt that contains many lines, each line is a value for the parameter of the python script: hello world this is...

String check incorrectly returning true

So I have been playing around in batch trying to make a simple batch game. So now what have I done wrong? Here is the code: :promotions_sucessful cls if %division%==Bronze V ( set league=Bronze IV set lp=0 echo You have been promoted! del promotion.txt pause>nul goto menu ) if %division%==Bronze...

How to retrieve the name and path of VM's through powercli

am using the below script to retrieve the NAME and PATH of the VM's and in the PATH am getting the full length path which i dont want it, i just need the path which is displaying after the Resources in the output here is my code: function Get-Path{ param($Object)...

How to create a powershell script that triggers a NuGet Update-Package –reinstall?

I have a nuget spec that installs both library file (dll) and two zip packages on a specific folder. Updating the packages is no issue when doing it from Visual Studio 2013 manually. However, when it is being triggered from either our CI servers TeamCity and CCNet, it is only...

As only show the words found in the findstr

How do I display only the words found in the search instead of displaying the lines? My code: Findstr /li /G:"List.txt" "File.txt">"Result.TxT" List: Disc Music Song Album Result: DISC1312we7das67da 13dsdsa67dsahdsa7aMUSIC dsadsdfdsaSONG1223234235 The desired result: Disc Music Song ...

Programmatically accessing TFS history [closed]

I have a solution under TFS source control and had written some sample code using an external library that was deleted a few months ago. I am certain that the code was checked in before that class file was deleted. I am able to manually browse to previous versions of...

Changing input path in Batch - path manipulating/modification

I have a simple batch like this: SETLOCAL @echo off SET sourceRoot=d:\SVN\Project\Debug\General\ServicePortal\bin SET destinationRoute=d:\SVN\Project\Debug\General\Admin Project\ I can pass "d:\SVN\Project\Debug\General\Admin Project" through parameter to the bacth, but I don't know how can I cut the last folder "\Admin Project" and combine with "\ServicePortal\bin". Is it possible? Thx in advance...

Powershell Reading text file

I'm just wondering if it's possible to read the content of text file with specific index? What I mean is like this, for example: I have text file like this, 'test1.txt' 12345678900 ## ## readthistext 54321123440 ## ## hellothistext I just want to read the content of text file after...

Why does piping Get-PSSession to Exit-PSSession not work?

I'm creating a new Powershell session like so: New-PSSession -ConnectionUri https://myserver:12345 -Credential myserver\username -Authentication default This is working fine, I can do Get-PSSession and it provides me with that one session. However, when trying to pipe the result to Exit-PSSession things go haywire. So this: Get-PSSession | Exit-PSSession Or this:...

Fastest way to count lines in a file

I have huge CSV file, which I want to know the total number of rows in which. Currently I am using something like this, which works perfectly, but it's slow: FIND /c ";" FILENAME.csv But I dunno if that's the fastest way to iterate through all lines in a CSV....

PowerShell XML formatting issue

I'm having trouble getting a properly formatted XML file using the following code: # Get Computer System info $CompInfo = Get-WmiObject Win32_ComputerSystem $CompName = $CompInfo.Name # Get IP Address $IPAddressTemp = Test-Connection $CompName -count 1 | select Address,Ipv4Address $IPAddress = $IPAddressTemp.IPV4Address # Begin Writing values to XML Document $filePath =...

Batch - Comparing two txt files

I have some difficulties comparing two txt files with batch. I used the "findstr" function with many option matchings but none works (for example FINDSTR /I /V /B /G:file1.txt file2.txt). I have a first txt file as following: File1.txt Object 1 Argument 50 Object 2 Argument 10 Object 3 Argument...

Parsing the text file line-by-line using batch script (batch file)

So, I am programming in the batch script and I came across this issue. The following code will take yourwords.txt file and parse it. The existedWord variable will have the last word of the text file. So, everytime when I run this program it will only compare the user's input...

How do I select a string from a string and replace it in powershell?

I'm trying to write a powershell instance that finds and replaces each instance of text and replaces it. UserRights "rights_wo_view" I need to place parenthesis around the quotes. I've been trying all kinds of things, but I'm running flat. $files = get-item C:\Users\programmer\Documents\Project\tsbrick\*.asp foreach ($file in $files) {(Get-Content $file) select-string...

Filter and delete Registry values with Where-Object

I'm not sure why I'm finding this so difficult. From under a particular registry key, I'd like to query certain registry-values based on their data (not name), and delete the resulting registry-values. For example: How would I delete any values in this key that contain, let's say, "foo". I can...

How do i handle ERRORLEVEL 9 in cmd

I have developed a batch script which checks for the version of the software installed on a machine and based on the version it picks up the correct version patch and installs it (runs) on the machine. However i am facing an issue where when i check for a particular...

Using --check on a md5sum command generated checksum file is failing

I'm encountering an error when I try and run md5sum -c on a checksum file I generated. I should mention that I'm running this from PowerShell (as a script will be running this eventually) and this is the cygwin version of md5sum. I have a test file, jira_defect.txt and I've...

Define an array with prefixes using the range operator

From this I can see I can do this with range operator: $myArray = @(4..9) But how can I do something like this: $myArray = @(usr4..9) I have tried various deviations of this with nonsense errors: $myArray = 4..9 | %\{ "usr$_"\} ...

PowerShell - Convert CSV to XLSX

I found this script on here, please help me understand this better. What is the whole "gps" part of the script for? What part of this script is overwriting my original CSV and copying in the PC's taskmanager list? Processes. What does this do, why 51? ($xlOut,51) I went searching...

Join SQL query Results and Get-ChildItem Results

Background: I have a directory with a number of files that are imported to SQL server. Task: Creating a PowerShell script which will pick up files within this directory and use the filenames as in the SQL query. Ultimate objective: To display SQL results besides the filenames but the resultset...

Batch file to check program installation

I am trying to determine if some program has been installed and, if it has, open it. If the program has not been installed, an alternate program should open. For example, if Notepad++ has been installed, the script should open that; if not, Notepad should be opened instead. Any advice...

Why doesn't “go get gopkg.in/…” work while “go get github.com/…” OK?

I try to use go get gopkg.in/fatih/pool.v2 to install pool according to Readme.md, but can't success: C:\Users\xiaona\Documents\GitHub> go get -v gopkg.in/fatih/pool.v2 Fetching https://gopkg.in/fatih/pool.v2?go-get=1 https fetch failed. Fetching http://gopkg.in/fatih/pool.v2?go-get=1 import "gopkg.in/fatih/pool.v2": http/https fetch: Get http://gopkg.in/fatih/poo l.v2?go-get=1: dial tcp ConnectEx tcp: A connection attempt failed because the connected party did not...

Post messages from async threads to main thread in F#

There is a subscription to an observable that sends out log messages. Some of the log messages come from other threads because they are are in F# async blocks. I need to be able to write out the messages from the main thread. Here is the code that currently filters...

Remove all folders .old

I'm trying to delete all folders in \\kiewitplaza\vdi\Appsense_profiles that end with .old. The piece I have that says Write-Host $name is just me trying to test before I delete anything. $name = Get-ChildItem "\\kiewitplaza\vdi\Appsense_profiles" if ($name.name.EndsWith(".old")) { Write-Host $name #Remove-Item "\\kiewitplaza\vdi\Appsense_profiles\$name.old" } ...

I cannot use the msg command in cmd (or batch for that matter). How can I fix this?

While in cmd or making a batch file, I cannot use the command msg. When I try to use it, it returns the error msg is not recognized as an internal or external command, operable program or batch file." I'm pretty sure the error is that im missing a msg.exe...

CPU usage missing from log for some processes

I'm trying to get information on all processes and services and save it into a .log. Here my Problem: Some processes have noting inside the CPU table, there I want to add something like "Nothing". How can I achieve that? That is my code so far: $ProcessTable = @{Expression={$_.ProcessName};Label="ProcessName";Width=40}, @{Expression={$_.CPU};Label="CPU";Width=20}...

String parsing with batch scripting

I have a file called pictures.xml and it contains some pictures information like: <ResourcePicture Name="a.jpg"> <GeneratedPicture Name="b.jpg"/> <GeneratedPicture Name="c.jpg"/> </ResourcePicture> <ResourcePicture Name="z1.jpg"> <GeneratedPicture Name="z2.jpg"/> <GeneratedPicture Name="z3.jpg"/> <GeneratedPicture Name="z4.jpg"/> </ResourcePicture> What I want do do is to get each line in for loop and print the names of the pictures. Sample...

What is the `.` shorthand for in a PowerShell pipeline?

I'm looking over a block of code I've used (sourced from another question) and I haven't been able to figure out what the . in .{process represents in this snippet (comments removed): Get-ItemProperty $path | .{process{ if ($_.DisplayName -and $_.UninstallString) { $_ } }} | Select-Object DisplayName, Publisher, InstallDate, DisplayVersion,...

Powershell workflow - Get-Service not filtering

I am trying to restart Windows services in parallel via Powershell workflow. When I use Get-Service -DisplayName "S*" outside of workflow I get expected results. However, when I use the same in workflow, I get ALL services instead. It seems that -Displayname parameter is ignored in workflow. How do I...

Format a command in powershell including a comma, can't find the right way to escape

I have a command that I need to run in a Powershell script, the command is : ".\pacli DELETEUSER DESTUSER='"[email protected]`,com"' sessionid=333" | invoke-expression The comma (,) in here :[email protected],com is not a mistake, and that's what is giving me the hard time. I tried to escape the comma with `...