How to list all server Locale and Reginal setttings as CSV ?

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
ITEngineer
Posts: 145
Joined: Wed Oct 12, 2011 10:52 am

How to list all server Locale and Reginal setttings as CSV ?

Post by ITEngineer » Mon Dec 22, 2014 5:16 pm

Hi,

Can anyone please assist me how to show the list the Locale and Reginal settings of all servers in a particular OU ?

Here's what I can start with:
PowerShell Code
Double-click the code block to select all.
$path = "C:\temp\"
$serverlist = Get-QADComputer -SearchRoot 'mydomain.com/Servers/Remote Servers' -OSName "Windows*Server*" -ShowProgress -Activity

foreach ($server in $serverlist){
	$result = Test-Connection $server -Count 1 -Quiet
	if ($result -eq "True") {
         # I need some help here.....
	}
	else {
		Add-Content "$path\Offline.txt" -Value $server
	}
}
Feel free to edit the above code if it doesn't work.

Thanks in advance.
Last edited by ITEngineer on Mon Dec 22, 2014 5:32 pm, edited 1 time in total.
/* IT Engineer */

User avatar
SAPIEN Support Forums
Posts: 945
Joined: Wed Dec 03, 2014 2:26 pm

How to list all server Locale and Reginal setttings as CSV ?

Post by SAPIEN Support Forums » Mon Dec 22, 2014 5:16 pm

This is an automated post. A real person will respond soon.

Thank you for posting, albertwt.

Here are some hints to help you get an accurate and complete answer to your question.

Ask in the best forum: If you asked in the wrong forum, just copy your question to the right forum.

Anticipate follow-up questions!

Did you remember to include the following?
  • 1. Product, version and build
    2. 32 or 64 bit product
    3. Operating system, e.g. Windows 7 64 bit.
    4. Attach a screenshot, if applicable
    5. Attach logs, crash reports, etc., in a ZIP file
If not, please take a moment to edit your original post or reply to this one.

*** Make sure you do not post any licensing information ***

User avatar
jvierra
Posts: 13717
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to list all server Locale and Reginal setttings as C

Post by jvierra » Mon Dec 22, 2014 6:36 pm

I just posted the answer in you other thread,

User avatar
ITEngineer
Posts: 145
Joined: Wed Oct 12, 2011 10:52 am

Re: How to list all server Locale and Reginal setttings as C

Post by ITEngineer » Mon Dec 22, 2014 6:48 pm

jvierra wrote:I just posted the answer in you other thread,

which one man ? I cannot see it :shock:
/* IT Engineer */

User avatar
jvierra
Posts: 13717
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to list all server Locale and Reginal setttings as C

Post by jvierra » Mon Dec 22, 2014 6:48 pm

Notice this shows the user registry: http://p0w3rsh3ll.wordpress.com/2012/01 ... er-locale/

User avatar
ITEngineer
Posts: 145
Joined: Wed Oct 12, 2011 10:52 am

Re: How to list all server Locale and Reginal setttings as C

Post by ITEngineer » Mon Dec 22, 2014 6:58 pm

jvierra wrote:Notice this shows the user registry: http://p0w3rsh3ll.wordpress.com/2012/01 ... er-locale/
yes, I can execute it from my local machine using one liner:
PowerShell Code
Double-click the code block to select all.
[System.Globalization.CultureInfo]([int]("0x" + (Get-WmiObject Win32_OperatingSystem).locale))
But how to put that intothe script so that th result is showing Servername, Culture DisplayName ?
/* IT Engineer */

User avatar
jvierra
Posts: 13717
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to list all server Locale and Reginal setttings as C

Post by jvierra » Mon Dec 22, 2014 7:51 pm

You cannot. You have to write a script to do that.

User avatar
ITEngineer
Posts: 145
Joined: Wed Oct 12, 2011 10:52 am

Re: How to list all server Locale and Reginal setttings as C

Post by ITEngineer » Mon Dec 22, 2014 8:18 pm

jvierra wrote:You cannot. You have to write a script to do that.
yes, that's why I ask in this forum how to do that ?
/* IT Engineer */

User avatar
jvierra
Posts: 13717
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to list all server Locale and Reginal setttings as C

Post by jvierra » Mon Dec 22, 2014 9:10 pm

First learn how to do a loop and also how to display the vales returned from a WMI query.

Have you any experience at all writing scripts? I can give you some links to learning sites. It is anot really all that hard.

User avatar
jvierra
Posts: 13717
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: How to list all server Locale and Reginal setttings as C

Post by jvierra » Tue Dec 23, 2014 11:44 am

Here is a starter:
PowerShell Code
Double-click the code block to select all.
Get-WmiObject Win32_OperatingSystem -computer pc001 |
    select CSNAme,locale

Locked