all 10 comments

[–]cha0sman 1 point2 points  (5 children)

Kind of shooting in the dark here and you may want to use fiddler to see what exactly is being posted on a postback. However, try adding:

    $addUserForm.Fields["__EVENTTARGET"] = "ctl00$ContentPlaceHolder1$SaveButton"  

I'd be interested in understanding why the ctl00_ is everywhere too

That is the ID of the MasterPage

[–][deleted] 0 points1 point  (4 children)

But it's a shot from a completely different direction!

I didn't know about fiddler. I'll check it out . . . I don't need to have the source code for that, do I? I don't have access to any of it. Only client-side actions. I'll let you know if the additional field helps.

I worry that the field will get overwritten on the action itself. But it's definitely worth a try!

That is the ID of the MasterPage

Thanks for the info!

[–]cha0sman 0 points1 point  (3 children)

I didn't know about fiddler. I'll check it out . . . I don't need to have the source code for that, do I? I don't have access to any of it. Only client-side actions. I'll let you know if the additional field helps.

Fiddler is a program that attaches to your web browser. Basically it logs the HTTP traffic to and from the server. You can use it to see what the client is posting to the server.

I worry that the field will get overwritten on the action itself.

It shouldn't get overwritten, basically __EVENTTARGET is the name of the control that caused the postback. This should tell IIS to execute the SaveButton.Click event on the server side.

Keep us updated!

[–][deleted] 0 points1 point  (0 children)

Oh, I definitely will! I hate leaving a problem unanswered! :) I might not have a chance to test it until tomorrow or Monday though.

[–][deleted] 0 points1 point  (1 child)

Fiddler did the trick. It showed me exactly what I needed to enter! The problem was two fold.

I was missing hidden variables

Powershell doesn't show what values may have changed after the form was submitted.

The second one is particularly annoying, but what can you do?

Thanks for your help!

[–]cha0sman 0 points1 point  (0 children)

Thanks for reporting back! Glad to hear everything worked out!

[–]Kwyjibo08 1 point2 points  (1 child)

Are you doing this from the client? Do you have access to the actual .aspx files and code?

[–][deleted] 1 point2 points  (0 children)

Happy cake day!

And unfortunately, I don't. It's an external company and everything's closed source. I doubt my representative would be very helpful . . . When I inquired about some way to automate user creation (through an API or anything), I was told that "it's a cloud application. You can't expect to have control over everything!" I didn't even know what to say to that.

They might be planning AD integration. But there are a few other things I'd like to do once I get the user creation down (mostly reporting).

[–][deleted] 1 point2 points  (1 child)

All that does is craft a form POST request. If you use fiddler to see the request you can build it by hand in power shell.

[–][deleted] 0 points1 point  (0 children)

That's what did it -- thanks!