Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 229504

Problem changing root password with Invoke-VMScript

$
0
0

I am using the following powershell script to automate changing the default root password of the VM ( Red Hat Linux) during VM customization step to the user supplied password. The script actually changes the password but it is returning non-zero return code (-1) thus causing a failure while trying to copy the script out to local temp folder in local host where script being executed from. I tried changing output folder by modifying environment variable $env:temp to shared folder in the local host but the script is still trying to copy the file to 'C:\Windows\TEMP\.  The error message is confusing , not sure if the issue on the guest OS or the host from where the script is being executed. We are using the default root credentials to perform the password change and root should have privileges to copy files from /tmp folder. Has anyone encountered anything similar to this problem? Does any one has any suggestion? I will be happy if I could some how suppress or redirect the out to somewhere else to bypass this copy file error.

 

 

 

 

Thanks Ayaz

 

 

 

Add-PSSnapin VMWare.VIMAutomation
Core Connect-VIServer -server $args[0] -user $args[1] -password $args[2]
$newPasswd=$args[5]
$cmdline="echo -e " + $newPasswd + " |  passwd --stdin root"
Invoke-VMScript -VM $args[3]  -GuestUser root -GuestPassword $args[4]-ScriptType Bash -ScriptText $cmdline

 

 

 

Invoke-VMScript : 7/30/2013 9:08:23 AM    Invoke-VMScript While performing operation 'Copy file '/tmp/vmware7' to 'C:\Windows\TEMP\tmp8CF7.tmp'. The file contains script output for VM 'AyazVM'' the following error occured: 'Authentication failure or insufficient permissions in guest operating system'    At C:\VMTemp\TEO_WorkingDir_d8caf83a-3da1-4557-bc6d-065def0e066a\TEO_PSScript_d8caf83a-3da1-4557-bc6d-065def0e066a.ps1:5 char:16+ Invoke-VMScript <<<


Viewing all articles
Browse latest Browse all 229504

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>