Automation

 View Only
  • 1.  Warning Message while running the script

    Posted Mar 09, 2018 08:00 AM

    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



  • 2.  RE: Warning Message while running the script
    Best Answer

    Posted Mar 09, 2018 09:29 AM

    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.



  • 3.  RE: Warning Message while running the script

    Posted Mar 09, 2018 01:48 PM

    Thank you for the update



  • 4.  RE: Warning Message while running the script

    Posted Dec 07, 2023 10:54 PM

    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.