我正在尝试制作一个visual studio app脚本,以使用户处于活动目录中。一切正常,直到我尝试设置用户主驱动器的路径并将路径设置为H:
任何人都可以解释为什么这不起作用?
Private Sub Button_Click(sender As Object, e As EventArgs) Handles Button.Click
Dim Command As String
'creating home diretorys'
Command = "mkdir \\bw-file-01\student$\EY{year}\APPTesting"
Command = Replace(Command, "{year}", Year.Text)
MsgBox("Direcotry has been made in" & Year.Text & "file path")
'setting up account'
Command = "dsadd user ""cn={fstname}.{lstname},ou=New_users,ou=students,ou=users," & _
"ou=Broadwater School,dc=broadwater,dc=surrey,dc=sch,dc=uk"" " & _
"-disabled yes -pwd password -mustchpwd yes -desc {desr} -email {fstname}.{lstname}@broadwater.surrey.sch.uk -upn ""{fstname}{lstname}@broadwater.surrey.sch.uk"" " & _
"-fn ""{fstname}"" -ln ""{lstname}"" -Display ""{fstname} {lstname}"""
Command = Replace(Command, "{fstname}", Firstnamebox.Text)
Command = Replace(Command, "{lstname}", Surnamebox.Text)
Command = Replace(Command, "{desr}", desr.Text)
Command = Replace(Command, "{year}", Year.Text)
MsgBox("Account has been made in the" & Year.Text & "group")
Command = "Set-ADuser -Identity $_ -HomeDrive {homedrive} -HomeDirectory {filepath}"
Command = Replace(Command, "{homedrive}", "H:")
Command = Replace(Command, "{filepath}", "\\bw-file-01\student$\EY2014\AppTesting")
MsgBox("Home folder has been set up")
Shell("cmd /c" & Command, 1, True)
End Sub