You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a bug in this script where it tries to write to the $error variable. This is a reserved powershell variable, so it needs to be changed to something else.
# add the resulting object to the array holding all the data
$allVSSWritersList += $px
# reset the results object for the next writer
$px = NewVSSObject -Server $server
# add the resulting object to the array holding all the data
$allVSSWritersList += $px
# reset the results object for the next writer
$px = NewVSSObject -Server $server
}
Also, an alternative to the Invoke-Command call, you can use psexec, such as: $writers = $( & $pathtoPSExec "$server" -accepteula -h vssadmin list writers) -split "nr"
The text was updated successfully, but these errors were encountered:
There's a bug in this script where it tries to write to the $error variable. This is a reserved powershell variable, so it needs to be changed to something else.
So change this block:
if ( $writerName -like "Microsoft Exchange*" ) {
$state = $writers[ $lineNum + 3 ].trim()
$error = $writers[ $lineNum + 4 ].trim()
Add-Member -InputObject $px -MemberType NoteProperty -Name "State" -Value $state.substring( 7, $state.length-7 )
Add-Member -InputObject $px -MemberType NoteProperty -Name "Error" -Value $error.substring( 12, $error.length-12 )
}
To this:
if ( $writerName -like "Microsoft Exchange*" ) {
$state = $writers[ $lineNum + 3 ].trim()
$vsserror = $writers[ $lineNum + 4 ].trim()
Add-Member -InputObject $px -MemberType NoteProperty -Name "State" -Value $state.substring( 7, $state.length-7 )
Add-Member -InputObject $px -MemberType NoteProperty -Name "Error" -Value $vsserror.substring( 12, $vsserror.length-12 )
Also, an alternative to the Invoke-Command call, you can use psexec, such as:
$writers = $ ( & $pathtoPSExec "$server" -accepteula -h vssadmin list writers) -split "
n
r"The text was updated successfully, but these errors were encountered: