Powershell script not completely executing...

Hi,

Thanks for the comments/suggestions.

Re. the “echo” problem, I think that I wasn’t being clear. What I wanted to do was to do the “echo $(whoami)” and have the output of that re-directed to a file, somewhere, in order to try to test/understand what user the commands that are being run under the “raw” module are running. As I said, I’m guessing that they are not running under the same user as the commands that are run under the script module. But then, when I tried the echo, running under raw module, outputting to the filesystem, it failed with “access denied”, even if I tried outputting to the E: drive somewhere.

So, it’s a “catch-22” situation: It seems like commands running under the raw module are running under a different (maybe “no”) user than commands running inside a ps1 running under a script module, but my test to try to find out which user that is is failing.

Re. your comments in your last paragraph: I agree that there’s a lot going on, but if you recall, I already had these same set of commands (script) running Chef previously, and am trying to see how far I could get with replicating what I was able to do with Chef but using Ansible instead, as I think that Ansible’s push model fits our use case better.

Thanks again,
Jim

I don’t know too much about the “raw” module on WIndows as I never use it, but I can assure you it’s running under the use specified in hosts. There’s no magic there. The problem seems to be related to running “echo” which is a cmd powershell doesn’t understand. from the looks of it raw implements a powershell host.

if you want to output the current user you could do something like
ansible -m raw -a ‘set-content C:/currentuser.txt -value $(whoami)’ all

and to read it:
ansible -m raw -a ‘get-content C:/currentuser.txt’ all

I am just learning Ansible myself for SharePoint installations on Windows. I am very very familiar with SharePoint on Windows. Any updates on the Ansible process?

Not sure what you’re referring to?