New Question
0

wmi fails to run in powershell LocalScripts

asked 2016-06-10 20:05:44 +0200

trodemaster gravatar image

I have written a powershell script that runs with the LocalScripts plugin. It's using the #ps1sysnativ lin and most of the code runs as expected. However anything that calls wmi like (gwmi win32operatingsystem).OperatingSystemSKU fails with a generic error. Has anybody ran into this?

powershell transcript of the code failing. https://gist.github.com/trodemaster/a...

Thanks, Blake

edit retag flag offensive close merge delete

Comments

From further investigation is seems the point in the sysprep process that cloudbase-init runs user scripts is to early. WMI is not available. I have attempted to use the exit codes to have the script re-run later but didn't help. Now I'm looking at using setupcomplete.cmd instead.

trodemaster gravatar imagetrodemaster ( 2016-06-13 21:49:20 +0200 )edit

2 answers

Sort by » oldest newest most voted
0

answered 2016-06-15 19:34:23 +0200

avladu gravatar image

Hello,

make sure you add the localscripts plugin execution to the non-unattend cloudbase-init configuration file, as the first cloudbase-init run is started by setupcomplete.cmd .

Thanks,

Adrian.

edit flag offensive delete link more

Comments

I have moved the localScripts plugin execution to the non sysprep executed cloudbase-init run with some success. Looking like some plugins need to run in each pass.

trodemaster gravatar imagetrodemaster ( 2016-06-15 21:33:16 +0200 )edit
0

answered 2016-06-23 13:37:39 +0200

Hello,

Could you please provide the cloudbase-init log regarding this problem?

Thanks,

Stefan.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-10 20:05:44 +0200

Seen: 1,015 times

Last updated: Jun 23 '16