User Tools

Site Tools


userspace:opsi2ad

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
userspace:opsi2ad [2014/02/12 14:24]
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 >DATABASE-HOST< >DATABASEUSER< >PASSWORD< >DATABASE(near mysql.exe) and >YOUR-DOMAIN-SUFFIX(near For-Each) to fit for your setup
   - 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 19: Line 19:
 chcp 850 chcp 850
 echo "SET NAMES 'cp850' ; select hostId, description from HOST" | ` echo "SET NAMES 'cp850' ; select hostId, description from HOST" | `
-./mysql.exe --default-character-set=utf8 -hDATABASE-HOST -uDATABASEUSER -pPASSWORD -DDATABASE > .output.sql+./mysql.exe --default-character-set=utf8 -h>DATABASE-HOST-u>DATABASEUSER< -p>PASSWORD< -D>DATABASE< > .output.sql
    
 # Convert SQL output to valid CSV output # Convert SQL output to valid CSV output
Line 30: Line 30:
 Import-Csv ./.output.csv -encoding utf8 -Delimiter ";"  |` Import-Csv ./.output.csv -encoding utf8 -Delimiter ";"  |`
     ForEach-Object {     ForEach-Object {
-        $hostId += $_.hostId.ToUpper().Replace(".YOUR-DOMAIN-SUFFIX","")+        $hostId += $_.hostId.ToUpper().Replace(".>YOUR-DOMAIN-SUFFIX<","")
         $description += $_.description         $description += $_.description
  
userspace/opsi2ad.txt ยท Last modified: 2021/08/23 08:37 (external edit)