AutomoxAutomox

Log Quesiton

daniel.newman
April 8, 2022 at 4:55 pm UTC

Is there a way to echo a command and make the status of a worklet visible?

 

Example; if I sent a PS command to a system lets say to unjust something. I would like to see something in the logs showing a status. 

powershell1 line
Get-NetAdapter | foreach { Disable-NetAdapterBinding -InterfaceAlias $_.Name -ComponentID ms_tcpip6 }

Current log shows: 

1

nothing else.

Maybe something on how to echo the results or response from the command.

This discussion is archived and closed to replies. Continue it in the Automox Community Slack.

Discuss on Slack

Replies (1)

jack.smithApril 12, 2022
#1

@daniel.newman one way to get more output is to introduce some Boolean logic and add in the logging of choice based on what is being done. 

powershell24 lines
Get-NetAdapter | ForEach-Object {

    # Get Current State
    $ip6 = Get-NetAdapterBinding -InterfaceAlias $_.Name -ComponentID ms_tcpip6

    # React to Current State
    IF($ip6.Enabled -eq $true){

        # Disable
        Disable-NetAdapterBinding -InterfaceAlias $_.Name -ComponentID ms_tcpip6

        # Check Status of Disabling
        IF($?){ 
            Write-Output "Net Adapter [ $($_.Name) ] ms_tcpip6 was successfully disabled. "
        }else{
            Write-Output "Net Adapter [ $($_.Name) ] ms_tcpip6 was not disabled. "
        }

    }else{
        # Disabled
        Write-Output "Net Adapter [ $($_.Name) ] ms_tcpip6 already disabled. "
    }

} # end ForEach