Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Any Powershell gurus here?

Thread Tools
 
Search this Thread
 
Old 04 March 2015, 11:08 AM
  #1  
Wurzel
Scooby Senior
Thread Starter
iTrader: (1)
 
Wurzel's Avatar
 
Join Date: Nov 2000
Location: Wildberg, Germany/Reading, UK
Posts: 9,706
Likes: 0
Received 73 Likes on 54 Posts
Cool Any Powershell gurus here?

I have this PS command line I use to auto renames windows machine installed from our SA server. It works in English, German and Spanish but when I ran it on a Russian system it fails. It does an nslookup on the dhcp address supplied to the machine and then replaces the default hostname given to the VM by my unattended XML file so it is shown properly in vCentre and can be used for RDP.

here is the command:

powershell -command "$name=((gwmi Win32_NetworkAdapterConfiguration | ? {$_.IPAddress -ne $null }).ipaddress | Select-Object -First 1 | nslookup $_ | Select-String -Pattern \"имя:\").Line; $name = $name -Replace \"имя:\", \"\"; $name=$name.Trim(); $nameSplit = $name -split \"\.\"; $name =$nameSplit[0]; netdom renamecomputer $env:COMPUTERNAME /newname:$name /force"


And here is the error, It says a terminator is missing but I have no idea where from and as I said this script works on Windows 2008R2/2012R2 in English, German and Spanish but fails in Russian.

powershell : The string is missing the terminator: ".
At line:1 char:1
+ powershell -command "$name=((gwmi Win32_NetworkAdapterConfiguration | ? {$_.IPAd ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The string is missing the terminator: ".:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

+ CategoryInfo : ParserError: ( [], ParentContainsErrorRecordEx
ception
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

In English and German it is the same but in Spanish I hade to change Name to Nombre so I did the same in Russian and changed it to имя

But it fails on a missing terminator.

Anyone got any ideas what is wrong or missing?

Cheers
Steve

Last edited by Wurzel; 04 March 2015 at 01:05 PM.
Old 04 March 2015, 06:48 PM
  #2  
markjmd
Scooby Regular
iTrader: (11)
 
markjmd's Avatar
 
Join Date: May 2009
Posts: 4,341
Received 70 Likes on 50 Posts
Default

Originally Posted by Wurzel
I have this PS command line I use to auto renames windows machine installed from our SA server. It works in English, German and Spanish but when I ran it on a Russian system it fails. It does an nslookup on the dhcp address supplied to the machine and then replaces the default hostname given to the VM by my unattended XML file so it is shown properly in vCentre and can be used for RDP.

here is the command:

powershell -command "$name=((gwmi Win32_NetworkAdapterConfiguration | ? {$_.IPAddress -ne $null }).ipaddress | Select-Object -First 1 | nslookup $_ | Select-String -Pattern \"имя:\").Line; $name = $name -Replace \"имя:\", \"\"; $name=$name.Trim(); $nameSplit = $name -split \"\.\"; $name =$nameSplit[0]; netdom renamecomputer $env:COMPUTERNAME /newname:$name /force"


And here is the error, It says a terminator is missing but I have no idea where from and as I said this script works on Windows 2008R2/2012R2 in English, German and Spanish but fails in Russian.

powershell : The string is missing the terminator: ".
At line:1 char:1
+ powershell -command "$name=((gwmi Win32_NetworkAdapterConfiguration | ? {$_.IPAd ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The string is missing the terminator: ".:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

+ CategoryInfo : ParserError: ( [], ParentContainsErrorRecordEx
ception
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

In English and German it is the same but in Spanish I hade to change Name to Nombre so I did the same in Russian and changed it to имя

But it fails on a missing terminator.

Anyone got any ideas what is wrong or missing?

Cheers
Steve
I'm no powershell guru, but isn't this basically saying the string is missing a . which should be the first character? Or am I assuming too much logic from the error output?
Old 04 March 2015, 08:17 PM
  #3  
bioforger
Scooby Regular
iTrader: (1)
 
bioforger's Avatar
 
Join Date: Jan 2002
Location: Pig Hill, Wiltsh1te
Posts: 16,995
Received 5 Likes on 5 Posts
Default

I'm no powershell expert, but as a guess it doesn't like or recognise the Russian character set, seeing as it works fine in European languages, can you somehow cleverly replace the russian letters with the CHAR(number) equivalents?
Old 05 March 2015, 09:46 AM
  #4  
Wurzel
Scooby Senior
Thread Starter
iTrader: (1)
 
Wurzel's Avatar
 
Join Date: Nov 2000
Location: Wildberg, Germany/Reading, UK
Posts: 9,706
Likes: 0
Received 73 Likes on 54 Posts
Default

I have tried it without the russian characters and get the same error message that it is missing a terminator. It also failed in English on Korean and Chinese native installations aswell.

Butthen again the native Chinese, Japanese and Korean failed to install using its own native character set so I am not holding out much hope of fixing any of it.

Why can't everyone speak English it would make life so much easier
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Iain Young
Non Scooby Related
23
21 April 2004 03:12 PM
TonyNesta
Suspension
6
01 March 2004 10:20 PM
Huffer
Member's Gallery
2
07 July 2003 10:38 PM
jods
Computer & Technology Related
4
02 May 2003 03:45 PM
jods
Computer & Technology Related
1
19 September 2002 01:32 PM



Quick Reply: Any Powershell gurus here?



All times are GMT +1. The time now is 02:23 PM.