userspace:opsi2ad
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| userspace:opsi2ad [2014/02/10 14:33] – dkoch | userspace:opsi2ad [2021/08/23 10:37] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| 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 | ||
| Line 42: | Line 42: | ||
| $olddescription= $olddescription.Trim() | $olddescription= $olddescription.Trim() | ||
| - | echo " | + | echo "[$timestamp] Updating $hostId with description: |
| dsmod computer $hostou -desc " | dsmod computer $hostou -desc " | ||
userspace/opsi2ad.1392039224.txt.gz · Last modified: (external edit)
