imajaydwivedi / SQLDBATools

Powershell Module containing cmdlets for carrying out SQL DBA activities.
https://ajaydwivedi.com
MIT License
13 stars 6 forks source link

Wrapper-SdtDiskSpace - Error - "out-file : Could not find a part of the path #48

Open imajaydwivedi opened 2 years ago

imajaydwivedi commented 2 years ago

After running Update-Module, and with first job execution, got below error messages -

Looking for location of SQLDBATools module to import.. Module file found based on wrapper file location Import-Module "C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\SQLDBATools.psm1" -DisableNameChecking Loading module from $env:PSModulePath out-file : Could not find a part of the path 'C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\Logs\Wrapper-SdtDiskSpaceLog2021-11-27 07.32.08.txt'. At C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\Wrapper\Wrapper-SdtDiskSpace.ps1:78 char:28

  • ... 1,-10} {2}" -f "($((Get-Date).ToString('yyyy-MM-dd HH:mm:ss')))","(ST ...
  • 
    + CategoryInfo          : OpenError: (:) [out-file], DirectoryNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

out-file : Could not find a part of the path 'C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\Logs\Wrapper-SdtDiskSpaceLog2021-11-27 07.32.08.txt'. At C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\Wrapper\Wrapper-SdtDiskSpace.ps1:87 char:26

  • ... 1,-10} {2}" -f "($((Get-Date).ToString('yyyy-MM-dd HH:mm:ss')))","(IN ...
  • 
    + CategoryInfo          : OpenError: (:) [out-file], DirectoryNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

Get-ChildItem : Cannot find path 'C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\Logs' because it does not exist. At C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\Wrapper\Wrapper-SdtDiskSpace.ps1:88 char:1

  • Get-ChildItem -Path "$SdtLogsPath\$($Script.Replace('.ps1',"Log*. ...
  • 
    + CategoryInfo          : ObjectNotFound: (C:\Program File...ols\0.0.12\Logs:String) [Get-ChildItem], ItemNotFound 
    Exception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

out-file : Could not find a part of the path 'C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\Logs\Wrapper-SdtDiskSpaceLog2021-11-27 07.32.08.txt'. At C:\Program Files\WindowsPowerShell\Modules\SQLDBATools\0.0.12\Wrapper\Wrapper-SdtDiskSpace.ps1:94 char:26

  • ... 1,-10} {2}" -f "($((Get-Date).ToString('yyyy-MM-dd HH:mm:ss')))","(IN ...
  • 
    + CategoryInfo          : OpenError: (:) [out-file], DirectoryNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
imajaydwivedi commented 2 years ago

Made following changes on Wrapper-SdtDiskSpace -