This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
userspace:opsi2ad [2014/02/10 13:39] dkoch |
userspace:opsi2ad [2014/02/12 14:26] dkoch |
||
---|---|---|---|
Line 4: | Line 4: | ||
- You will have to store a mysql.exe binary in the same directory as the script. | - You will have to store a mysql.exe binary in the same directory as the script. | ||
- | - Replace DATABASE-HOST DATABASEUSER PASSWORD DATABASE (near mysql.exe) and YOUR-DOMAIN-SUFFIX (near For-Each) to fit for your setup | + | - Replace |
- Make sure your MySQL server listens ( bind-address in my.cnf ) | - Make sure your MySQL server listens ( bind-address in my.cnf ) | ||
- Execute this script as Domain-Administrator on an DC | - Execute this script as Domain-Administrator on an DC | ||
Line 10: | Line 10: | ||
+ | This Script requires Powershell 3 | ||
<code powershell> | <code powershell> | ||
# This script synchronizes the client descriptions from OPSI to the AD | # This script synchronizes the client descriptions from OPSI to the AD | ||
Line 19: | Line 19: | ||
chcp 850 | chcp 850 | ||
echo "SET NAMES ' | echo "SET NAMES ' | ||
- | ./mysql.exe --default-character-set=utf8 -hDATABASE-HOST -uDATABASEUSER | + | ./mysql.exe --default-character-set=utf8 -h> |
# Convert SQL output to valid CSV output | # Convert SQL output to valid CSV output | ||
Line 30: | Line 30: | ||
Import-Csv ./ | Import-Csv ./ | ||
ForEach-Object { | ForEach-Object { | ||
- | $hostId += $_.hostId.ToUpper().Replace(" | + | $hostId += $_.hostId.ToUpper().Replace(" |
$description += $_.description | $description += $_.description | ||