]> git.p6c8.net - dsmonrot.git/blobdiff - dsmonrot.ps1
Suppress output of New-PSDrive and New-Item
[dsmonrot.git] / dsmonrot.ps1
index 0323afbbaa4a3516de57cc696481bbf3db00b198..c0ee230622cea573cbd3bdca81315f6036d80aa2 100644 (file)
@@ -134,12 +134,12 @@ if($smbDrive) {
                        $secSmbPassword = $smbPassword | ConvertTo-SecureString -asPlainText -Force\r
                        $smbCredential = New-Object System.Management.Automation.PSCredential($smbUser, $secSmbPassword)\r
 \r
                        $secSmbPassword = $smbPassword | ConvertTo-SecureString -asPlainText -Force\r
                        $smbCredential = New-Object System.Management.Automation.PSCredential($smbUser, $secSmbPassword)\r
 \r
-                       New-PSDrive -Name $smbDrive -PSProvider "FileSystem" -Root $smbPath -Credential $smbCredential -Persist -ErrorAction Stop\r
+                       New-PSDrive -Name $smbDrive -PSProvider "FileSystem" -Root $smbPath -Credential $smbCredential -Persist -ErrorAction Stop | Out-Null\r
                }\r
                else {\r
                        Write-Host "Without credentials"\r
                \r
                }\r
                else {\r
                        Write-Host "Without credentials"\r
                \r
-                       New-PSDrive -Name $smbDrive -PSProvider "FileSystem" -Root $smbPath -Persist -ErrorAction Stop\r
+                       New-PSDrive -Name $smbDrive -PSProvider "FileSystem" -Root $smbPath -Persist -ErrorAction Stop | Out-Null\r
                }\r
                \r
                $smbConnected = $True\r
                }\r
                \r
                $smbConnected = $True\r
@@ -177,7 +177,7 @@ if($errorMessages.Count -eq 0) {
                        Write-Host "Creating directory $backupTargetDiff"\r
                        \r
                        try {\r
                        Write-Host "Creating directory $backupTargetDiff"\r
                        \r
                        try {\r
-                               New-Item -ItemType directory -Path $backupTargetDiff -ErrorAction Stop\r
+                               New-Item -ItemType directory -Path $backupTargetDiff -ErrorAction Stop | Out-Null\r
                        }\r
                        catch {\r
                                Write-Host "Could not create directory $backupTargetDiff`: $_.Exception.Message"\r
                        }\r
                        catch {\r
                                Write-Host "Could not create directory $backupTargetDiff`: $_.Exception.Message"\r
@@ -215,7 +215,7 @@ if($errorMessages.Count -eq 0) {
                        Write-Host "Creating directory $backupTarget"\r
                        \r
                        try {\r
                        Write-Host "Creating directory $backupTarget"\r
                        \r
                        try {\r
-                               New-Item -ItemType directory -Path $backupTarget -ErrorAction Stop\r
+                               New-Item -ItemType directory -Path $backupTarget -ErrorAction Stop | Out-Null\r
                        }\r
                        catch {\r
                                Write-Host "Could not create directory $backupTarget`: $_.Exception.Message"\r
                        }\r
                        catch {\r
                                Write-Host "Could not create directory $backupTarget`: $_.Exception.Message"\r
@@ -228,7 +228,7 @@ if($errorMessages.Count -eq 0) {
                                Write-Host "Creating directory $backupTargetFull"\r
                                \r
                                try {\r
                                Write-Host "Creating directory $backupTargetFull"\r
                                \r
                                try {\r
-                                       New-Item -ItemType directory -Path $backupTargetFull -ErrorAction Stop\r
+                                       New-Item -ItemType directory -Path $backupTargetFull -ErrorAction Stop | Out-Null\r
                                }\r
                                catch {\r
                                        Write-Host "Could not create directory $backupTargetFull`: $_.Exception.Message"\r
                                }\r
                                catch {\r
                                        Write-Host "Could not create directory $backupTargetFull`: $_.Exception.Message"\r

patrick-canterino.de