VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Warning Message while running the script

Hi,

When I am executing the below script, I am getting warning

Invoke-VMScript -vm $serv -ScriptText "echo rescan > c:\diskpart.txt && echo select vol $VolumeLetter >> c:\diskpart.txt && echo extend >> c:\diskpart.txt && diskpart.exe /s c:\diskpart.txt" -ScriptType BAT -GuestUser admin -GuestPassword "password"

WARNING: This property is deprecated and will be removed in a following release. It has been added for backwards compatibility with the string class that the Invoke-VMScript cmdlet used to return. Use the 'ScriptOutput' property instead.

Please help

Reply
0 Kudos
1 Solution

Accepted Solutions
zenivox
Hot Shot
Hot Shot
Jump to solution

Hi, as the message says that is only a warning. However in those cases the script continues to run and produces its output. So nothing to worry about except that you could study the suggestion and amend the script for the future.

View solution in original post

Reply
0 Kudos
3 Replies
zenivox
Hot Shot
Hot Shot
Jump to solution

Hi, as the message says that is only a warning. However in those cases the script continues to run and produces its output. So nothing to worry about except that you could study the suggestion and amend the script for the future.

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Thank you for the update

Reply
0 Kudos
DaveN2
Contributor
Contributor
Jump to solution

To not have the warning at all, assign the output to a variable.
$Output = Invoke-VMScript -vm $serv -ScriptText "echo rescan > c:\diskpart.txt && echo select vol $VolumeLetter >> c:\diskpart.txt && echo extend >> c:\diskpart.txt && diskpart.exe /s c:\diskpart.txt" -ScriptType BAT -GuestUser admin -GuestPassword "password"

In my experience, this warning only appears once per powershell window.  Several times I thought I had "fixed" it, only for it to reoccur after closing powershell and restartingi t.

Reply
0 Kudos