New Question
0

Error when running powershell commands

asked 2020-07-17 19:05:56 +0300

carolinahusker gravatar image

I'm using vRA to deploy a blue print. Within the cloud-config section of the YAML code, I'm attempting to run PowerShell commands.

  cloudConfig: |
    #ps1_sysnative
      new-item -Path 'c:\myfolder' -itemtype directory
      Copy-Item -Path '\\p10ittech01\vRATest\Hashing-2.1.exe' -Destination 'c:\myfolder'
      install-windowsFeature -name web-server -includeManagementTools
      Set-NetfirewallProfile -Profile Domain,Public,Private -Enabled False

The PS commands are unsuccessful and I receive the following error message in the logs: 2020-07-17 11:49:23.169 2160 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.userdataplugins.heat.HeatPlugin' loadclass C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init [-] plugin 'UserDataPlugin' failed with error 'while scanning a simple key in "<byte string="">", line 8, column 3 could not find expected ':' in "<byte string="">", line 9, column 3': yaml.scanner.ScannerError: while scanning a simple key 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init [-] while scanning a simple key in "<byte string="">", line 8, column 3 could not find expected ':' in "<byte string="">", line 9, column 3: yaml.scanner.ScannerError: while scanning a simple key in "<byte string="">", line 8, column 3 could not find expected ':' in "<byte string="">", line 9, column 3 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init Traceback (most recent call last): 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\init.py", line 67, in _execplugin 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init shareddata) 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\userdata.py", line 57, in execute 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init return self.processuserdata(userdata, service) 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\userdata.py", line 126, in _processuserdata 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init return self.processnonmultipart(userdata, service) 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\userdata.py", line 203, in processnonmultipart 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init retval = cloudconfigplugin.processnonmultipart(userdata) 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\userdataplugins\cloudconfig.py", line 110, in processnonmultipart 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init executor = CloudConfigPluginExecutor.fromyaml(part) 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\userdataplugins\cloudconfig.py", line 65, in fromyaml 2020-07-17 11:49:23.169 2160 ERROR cloudbaseinit.init content = yaml.load(stream, Loader=loader) 2020-07-17 11:49:23 ... (more)

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2020-07-21 11:25:09 +0300

avladu gravatar image

updated 2020-07-21 22:37:13 +0300

Hello,

This looks like a similar issue to https://ask.cloudbase.it/question/324... , but with a different error output. It looks like the userdata comes as cloud config, but not in a yaml format.

Can you please share the userdata that gets to the VM for further inspection? You should find it in the drive with drive_label = "OVF ENV" by default.

UPDATE: The problem was a syntax issue.

Thanks.

edit flag offensive delete link more

Comments

Dumb question... I've looked through the Cloudbase-init install directory and do not see userdata. Where does the userdata folder get created by default on the VM?

carolinahusker gravatar imagecarolinahusker ( 2020-07-21 17:04:52 +0300 )edit

You should have a different drive like E:\ or D:\ with the metadata file that contains the userdata. The drive label should be OVF ENV . Can you please share the cloudbase-init config file too? Found in the cbs-init install dir, conf folder?

avladu gravatar imageavladu ( 2020-07-21 19:26:27 +0300 )edit
1

The problem was my syntax. I copied a PowerShell command directly from PowerShell ISE and it failed. After recreating the syntax in the vRA blueprint it's working. Thank you for the help.

carolinahusker gravatar imagecarolinahusker ( 2020-07-21 21:05:20 +0300 )edit

Can you please share the syntax?

sri4784 gravatar imagesri4784 ( 2023-05-17 02:40:40 +0300 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-07-17 19:05:56 +0300

Seen: 1,134 times

Last updated: Jul 21 '20