Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Write-Progress problems

$
0
0

Ah, looks like -Status was a mandatory parameter in PowerShell 2.0; I assume that’s what you’re running? You can add it to each of the calls to Write-Progress, if so:

Write-Progress -Activity 'Configuring Network Adapter' -Status 'Processing' -CurrentOperation 'Assigning IP and Subnet' -PercentComplete 0
$iface.enablestatic($ip,$subnet)

Write-Progress -Activity 'Configuring Network Adapter' -Status 'Processing' -CurrentOperation 'Configuring DNS Servers' -PercentComplete 25
$iface.setdnsserversearchorder($dns)

Write-Progress -Activity 'Configuring Network Adapter' -Status 'Processing' -CurrentOperation 'Assigning Default Gateway' -PercentComplete 50
$iface.setgateways($gate)

Write-Progress -Activity 'Configuring Network Adapter' -Status 'Processing' -CurrentOperation 'Configuring DNS registration' -PercentComplete 75
$iface.SetDynamicDNSRegistration(“FALSE”)

Write-Progress -Activity 'Configuring Network Adapter' -Status 'Complete' -Completed

I am still getting the same prompt for status plus a new error. I did not think anything was wrong with the way I got the interface but this is an error meaning that the value cannot be used for write-progress?

Write-Progress : Cannot bind parameter ‘Id’. Cannot convert the “System.Management.ManagementBaseObject” value of type “System.Management.ManagementBaseObject#\__PARAMETERS” to type
“System.Int32″.
At C:\Users\brant\Documents\TCPSettings.ps1:47 char:19
+ Write-Progress <<<< -Activity ‘Configuring Network Adapter’ -Status ‘Processing’ -CurrentOperation ‘Assigning IP and Subnet’ -PercentComplete 0 $iface.enablestatic($ip,$subnet
)
+ CategoryInfo : InvalidArgument: (:) [Write-Progress], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WriteProgressCommand

Write-Progress : Cannot bind parameter ‘Id’. Cannot convert the “System.Management.ManagementBaseObject” value of type “System.Management.ManagementBaseObject#\__PARAMETERS” to type
“System.Int32″.
At C:\Users\brant\Documents\TCPSettings.ps1:49 char:15
+ Write-Progress <<<< -Activity ‘Configuring Network Adapter’ -Status ‘Processing’ -CurrentOperation ‘Configuring DNS Servers’ -PercentComplete 25 $iface.setdnsserversearchorder($dn
s)
+ CategoryInfo : InvalidArgument: (:) [Write-Progress], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WriteProgressCommand

Write-Progress : Cannot bind parameter ‘Id’. Cannot convert the “System.Management.ManagementBaseObject” value of type “System.Management.ManagementBaseObject#\__PARAMETERS” to type
“System.Int32″.
At C:\Users\brant\Documents\TCPSettings.ps1:51 char:15
+ Write-Progress <<<< -Activity ‘Configuring Network Adapter’ -Status ‘Processing’ -CurrentOperation ‘Assigning Default Gateway’ -PercentComplete 50 $iface.setgateways($gate)
+ CategoryInfo : InvalidArgument: (:) [Write-Progress], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WriteProgressCommand

Write-Progress : Cannot bind parameter ‘Id’. Cannot convert the “System.Management.ManagementBaseObject” value of type “System.Management.ManagementBaseObject#\__PARAMETERS” to type
“System.Int32″.
At C:\Users\brant\Documents\TCPSettings.ps1:53 char:15
+ Write-Progress <<<< -Activity ‘Configuring Network Adapter’ -Status ‘Processing’ -CurrentOperation ‘Configuring DNS registration’ -PercentComplete 75 $iface.SetDynamicDNSRegistrat
ion(“FALSE”)
+ CategoryInfo : InvalidArgument: (:) [Write-Progress], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WriteProgressCommand


Viewing all articles
Browse latest Browse all 13067

Latest Images

Trending Articles



Latest Images