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 Mar 4, 2015 | 11:08 AM
  #1  
Wurzel's Avatar
Wurzel
Thread Starter
Scooby Senior
iTrader: (1)
 
Joined: Nov 2000
Posts: 9,708
Likes: 73
From: Wildberg, Germany/Reading, UK
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; Mar 4, 2015 at 01:05 PM.
Reply
Old Mar 4, 2015 | 06:48 PM
  #2  
markjmd's Avatar
markjmd
Scooby Regular
iTrader: (11)
 
Joined: May 2009
Posts: 4,342
Likes: 70
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?
Reply
Old Mar 4, 2015 | 08:17 PM
  #3  
bioforger's Avatar
bioforger
Scooby Regular
iTrader: (1)
 
Joined: Jan 2002
Posts: 16,995
Likes: 5
From: Pig Hill, Wiltsh1te
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?
Reply
Old Mar 5, 2015 | 09:46 AM
  #4  
Wurzel's Avatar
Wurzel
Thread Starter
Scooby Senior
iTrader: (1)
 
Joined: Nov 2000
Posts: 9,708
Likes: 73
From: Wildberg, Germany/Reading, UK
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
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Iain Young
Non Scooby Related
23
Apr 21, 2004 03:12 PM
TonyNesta
Suspension
6
Mar 1, 2004 10:20 PM
Huffer
Member's Gallery
2
Jul 7, 2003 10:38 PM
jods
Computer & Technology Related
4
May 2, 2003 03:45 PM
jods
Computer & Technology Related
1
Sep 19, 2002 01:32 PM




All times are GMT +1. The time now is 05:37 AM.