I'm working on a script to apply some security settings. It is working on a vcenter(domain.local) that is in the same domain as the user account I use to run it and the systems it manages are also in the same domain(domain.local). I don't have to specify user/pass.
On another vcenter which is also in same domain (domain.local) the systems that it manages are not in domain.local, but are in DMZdomain.local. I added my DMZ account to the invoke-vmscript, but it is still using the credentials for the session, my domain.local account. What am I doing wrong?
ForEach ($server in $servernames)
{
Invoke-VMScript -vm $server -scripttext $ScriptCF -GuestUser dmzdomain\dmz-user -guestpassword password13 -scripttype powershell
}
Does adding the Verbose switch provide any more information?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No, just that is VERBOSE: performing the operation invoke-vmscript......
Yup, the Verbose output for Invoke-VMScript is rather sparse.
You might want to give the same a try with my Invoke-VMScriptPlus function with the Verbose switch.
It should provide more information.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You did mention DMZ, is port 902 open to the ESXi node where the VM is running?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Not sure on port 902. It looks like it is connecting, but it is getting access denied, because it is using an account that the system doesn't know.
I'm feeling like an idiot, I don't see what I am suppose to do with that code, I can't even find where Powercli is 'installed' it's not in C:\Windows\System32\WindowsPowerShell\v1.0\Modules, or in 'my documents' either.
Do a
Get-Module -Name VMware* -ListAvailable
That should tell you where the PowerCLI modules are installed
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I finally noticed the file download at the bottom of your page. I have that file now.
I see that the modules are in c:\program files\windowspowershell\modules
Do I put that file in one of the folders?
The file you downloaded contains a function, named Invoke-VMScriptPlus.
The easiest way to use it is to copy that to a .ps1 file, and then at the end of that .ps1 file add a line, outside the function, where you call Invoke-VMScriptPlus.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference