This is what i Have so far, unsure how to finish. param ( # accept a uri as a pa
ID: 3540223 • Letter: T
Question
This is what i Have so far, unsure how to finish.
param (
# accept a uri as a parameter (file or url will work); default is below
[string]$uri = "http://classfiles.esage.com/files/WinServer/accounts.xml"
)
# read the xml file
$xml = New-Object System.Xml.XmlDocument
$xml.Load($uri)
# iterate through the user accounts
$accountNodes = $xml.SelectNodes("/root/userManagement/user")
foreach ( $node in $accountNodes ) {
$commandArgs = " -SamAccountName " + $node.account + `
" -AccountPassword " + $node.password + `
" -GivenName " + $node.firstname + `
" -Surname " + $node.lastname + `
" -DisplayName `"" + $node.firstname + " " + $node.lastname + "`"" + `
" -Path `"OU=" + $node.ou + "`"" + `
" -ChangePasswordAtLogon" + `
" -Enabled"
# create each user
New-ADUser @commandArgs
}
Use the sample XML data accounts.xml, a portion of the file follows (you can download the full file from http://classfiles.esage.com/files/WinServer/accounts.xml )
Provide output as appropriate as the script executes.
Assumptions:
Explanation / Answer
u r doing right and i m sure u are correct
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.