How can I suppress the output of the following command? “Out-Null” doesn’t help.
“sync-cmd.exe” is cli part of the “Google Cloud Directory Sync”.
.\sync-cmd.exe -a -c C:\Scripts\sync2.xml | Out-Null
How can I suppress the output of the following command? “Out-Null” doesn’t help.
“sync-cmd.exe” is cli part of the “Google Cloud Directory Sync”.
.\sync-cmd.exe -a -c C:\Scripts\sync2.xml | Out-Null
Usually it helps to assign the output to a variable.
This code:
$temp = .\sync-cmd.exe -a -c C:\Scripts\sync2.xml | Out-Null
Gives the following output (in red): (only the first part did I copy as example)
.\sync-cmd.exe : [2025-01-07 12:21:00,960+0100] [Thread-1] [INFO] [google.usersyncapp.AppUpdateCheck] You are using the latest version: 5.0.37.
At line:3 char:9
+ $temp = .\sync-cmd.exe -a -c C:\Scripts\sync2.xml | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ([2025-01-07 12:...ersion: 5.0.37.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
[2025-01-07 12:21:01,538+0100] [main] [INFO] [usersyncapp.cli.Sync] Command line parameters used for this sync: [-a, -c, C:\Scripts\sync2.xml]
[2025-01-07 12:21:01,538+0100] [main] [INFO] [usersyncapp.cli.Sync] Starting Version 5.0.37 - C:\Scripts\sync2.xml
[2025-01-07 12:21:01,553+0100] [Thread-2] [INFO] [google.usersyncapp.LogRemoval] The configured log file name \\SCHOOL\Log\Gsuite\gcds_sync.log d
oes not include a timestamp, so logs older than 30 days would not be removed automatically
[2025-01-07 12:21:01,678+0100] [main] [INFO] [usersyncapp.cli.Sync] In-memory configuration check value: 1766388917
[2025-01-07 12:21:01,725+0100] [main] [INFO] [usersyncapp.cli.Sync] In-memory configuration: <?xml version="1.0" encoding="UTF-8"?>
<config version="5.0.37" id="fee6db0b42c34f8fb79c6b0b6a9d6804" rev="aeb46dc15d824a1ab8445078e3e606c4" marker="314">
<osDetails>Windows Server 2016 amd64</osDetails>
<javaVersion>1.8.0_422</javaVersion>
<javaVmName>OpenJDK 64-Bit Server VM</javaVmName>
<features>
<optional>ALIAS_SYNCHRONIZATION</optional>
<optional>BASE64_PASSWORD</optional>
What is sync-cmd.exe
? … the output does not look like a normal output - it looks like an error. You may redirect the error stream of the app to the standard stream to be able to capture it.
… and you should use either one - variable assignment OR Out-Null
… not both!
sync-cmd.exe is part of “Google Cloud Directory Sync”
The redirection solved my issue by using the following code:
.\sync-cmd.exe -a -c C:\Scripts\sync2.xml *> $null
(Just for future problems) “*>” to get all streams and “$null” to “remove” the stream. “$null” can be replaced by "C:\PATH\TO\FILE\file.log to capture it in a file.