i’m new to Powershell 7.0 and trying to use some old code from “classic” Powershell.
Unfortunately, i’m in trouble with the section of inputbox command.
Here a part of my script :
add-type -assemblyName “Microsoft.VisualBasic”
add-type -AssemblyName System.Windows.Forms
$strNow = Get-Date -Format g
[String]$UserName = $env:USERNAME
[String]$ComputerName = $env:COMPUTERNAME
$ComputerName = [Microsoft.VisualBasic.Interaction]::InputBox("Number PC… ", “Message - $strNow - $UserName”, $ComputerName)
On powershell 5, no issue but with the 7.0, i got the error :
Method invocation failed because [Microsoft.Visualbasic.Interaction] does not contain a method named ‘InputBox’.
I don’t understand why and how fix that. Is someone could help me ?
thanks a lot !