[Puppet Users] Puppet -- Powershell script

2016-09-19 Thread Shivayogi Kamat
I have an application which requires a local account to be required  for 
the configuration.
I have created a module inside that I have 2 folders :

i. files
ii.manifests

under manifests init file I have the below code:

class xyz {

exec { ' app_config':

 command => ' C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe 
-file c:\provisioning\modules\xyz\files\config1.ps1 '
}
}

Under files folder there are 2 files

i.  config1.ps1

ii. app_execute.bat

Under config1.ps1 I am creating a local user :
$user = $env:COMPUTERNAME/Testing

$Credentials = New-Object -TypeName 
System.management.Automation.PScredential -ArgumentList $user, 
("test@3456", | Convertto-securestring -ASplaintext -force)

Start-Process C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe 
-Credential $Credentials -ArgumentList " Start-Process 
C:\Windows\System32\cmd.exe -file 
c:\provisioning\c:\provisioning\modules\xyz\files\app_execute.bat "

Under app_execute.bat

c:\puppet\app.bat -f c:\puppet\responsefile.rsp

The log file shows that the powershell file config1.ps1 got executed 
successfully, but the application log file is not getting generated, but 
when executed manually the config1.ps1 the app will get configured.

Not sure, in config1.ps1, I am using a start-process which will create a 
separate process using the local account.

I think the puppet is not waiting for the above config1.ps1 to be completed 
succesfully.

Not sure why it is coming out without executing fully, Is there any 
condition, as we need to execute only  one file inside init, as I am 
initiating 2 processes.

Please advise.

 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/501ee411-8aa3-4a1e-9847-2381abca9fe4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet Local Account Notify Issue

2016-09-25 Thread Shivayogi Kamat


user { 'acc1':
  ensure  => present,
  managehome  => true,
  password=> 'Test123',
  groups  => ['Administrators'],
  auth_membership => 'minimum',
  notify  => Exec['app config']
}

exec { 'app config':
  path=> 'c:\\program files (x86)\\app\\bin',
  command => 'config.bat -f responsefile.rsp',
  refreshonly => true,

}


The user is getting created, but I need the local account to be used for the 
app configuration.

The above puppet script is executed by domain account abc\myname, and the 
application requires a local account to be used for the configuration.


So I have created a local account through puppet and using notify to tell exec 
to use the account created by the puppet. But when it is executed, the 
application is throwing error: need a local account or administrator

In logs the error is myname is not a local account or administrator.


I see that exec is not using the local user acc1 created by puppet.


Is there any other way wherein I can direct the exec to use a particular local 
user account to use for configuration.

Please advise

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/bde11996-9c41-44b5-8cee-d8043a147ff3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.