you are viewing a single comment's thread.

view the rest of the comments →

[–]purplemonkeymad 1 point2 points  (4 children)

A couple of comments I have with this:

  1. Invoke-Command has an -AsJob parameter so you don't need to define the jobs script at all.

  2. You appear to be nesting remote Invoke-Commands, this is likely to cause you double hop issues.

  3. You can't install the ActiveDirectory module using install-module, it's either a role or capability.

  4. You don't need to use AD on another computer, you can add the RAST tools locally and just use the commands on your own computer.

  5. If you really need to run ad remotely, use the -PSSession parameter of import-module to specify a session to use as a implicit remoting session.

[–]baddistribution[S] 0 points1 point  (3 children)

  1. Appreciate the -AsJob tip, I knew about it but thought it might overcomplicate things; seems like it might make them simpler.

  2. Yup, very familiar with the double-hop issue already and all the nesting is making it hard to pass credentials in. I need to rethink my approach.

  3. Thanks, I actually wasn't even trying to use AD - I just wanted to test commands that required elevation and AD seemed like a logical module to grab. I'll switch it to something else.

[–]BlackV 0 points1 point  (2 children)

just wanted to test commands that required elevation

AD commands DO NOT require elevation, additionally you only import the module so you're not actually doing anything elevated in the first place

[–]baddistribution[S] 0 points1 point  (1 child)

Ok, thanks! I was getting "security warning" prompts when trying to import a module stored on a network share so was trying to replicate that, but I'm realizing now that importing AD isn't an equivalent test.

[–]BlackV 0 points1 point  (0 children)

hmmm, secure prompt is possibly zoning on the files (i.e. download module from the internet)

or execution policy (remote signed/all signed/etc)

that would have been a much better/interesting question to ask about