ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Computer & Technology Related (https://www.scoobynet.com/computer-and-technology-related-34/)
-   -   Any Powershell gurus here? (https://www.scoobynet.com/computer-and-technology-related-34/1020969-any-powershell-gurus-here.html)

Wurzel 04 March 2015 11:08 AM

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

markjmd 04 March 2015 06:48 PM


Originally Posted by Wurzel (Post 11638679)
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?

bioforger 04 March 2015 08:17 PM

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?

Wurzel 05 March 2015 09:46 AM

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 :D


All times are GMT +1. The time now is 03:55 AM.


© 2024 MH Sub I, LLC dba Internet Brands