MySQL Forums
Forum List  »  Newbie

variables from PowerShell to database
Posted by: Alex M
Date: May 22, 2013 10:10AM

Hi. My intro.
I have generated some array from PowerShell. It looks like several:
DistinguishedName : CN=PC1,OU=COMPUTERS,OU=CITY,OU=FIRMA,DC=domain,DC=LOCAL
DNSHostName : PC1.DOMAIN.LOCAL
Enabled : True
Name : PC1
ObjectClass : computer
ObjectGUID : f8da0000-f4a9-45cd-a750-5f2e1df3b6db
SamAccountName : PC1$
SID : S-1-5-21-187615067-1267644000-423120465-1286
UserPrincipalName :

DistinguishedName : CN=PC2,OU=COMPUTERS,OU=CITY,OU=FIRMA,DC=domain,DC=LOCAL
DNSHostName : PC2.DOMAIN.LOCAL
Enabled : True
Name : PC2
ObjectClass : computer
ObjectGUID : f8da0000-f4a9-45cd-a750-5f2e1df3b6dc
SamAccountName : PC2$
SID : S-1-5-21-187615067-1267644000-423120465-1287
UserPrincipalName :

My case:
I set data this array to variable $computers:
$computers = MyPowershell.command
And now i want insert separate data from array:
"INSERT INTO computers (computers) VALUES ('$computers[0].Name')"
But in database is entered only first line from array:
CN=PC1,OU=COMPUTERS,OU=CITY,OU=FIRMA,DC=domain,DC=LOCAL
if i try enter command $computers[0].Name in powershell i am getting right data:
PC1
My question:
why mysql query not understand $computers[0].Name ? How i can isert only PC1 into database?

Thank you!

Options: ReplyQuote


Subject
Written By
Posted
variables from PowerShell to database
May 22, 2013 10:10AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.