xPSDesiredStateConfiguration icon indicating copy to clipboard operation
xPSDesiredStateConfiguration copied to clipboard

New-ZipFromPSModulePath helper function (DscPullServerSetup\DscPullServerSetup.psm1): Bug when renaming the .zip file

Open lavanack opened this issue 4 years ago • 1 comments

Details of the scenario you tried and the problem that is occurring

When using the Publish-DSCModulesAndMof helper function it raises the following error

Verbose logs showing the problem

Rename-Item : Cannot rename the specified target, because it represents a path or device name. At C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\9.1.0\Modules\DscPullServerSetup\DscPullServerSetup.psm1:145 char:21

  • ... $null = Rename-Item -Path "$source.zip" -NewName $newName -Force
  •              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [Rename-Item], PSArgumentException
    • FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.RenameItemCommand

Suggested solution to the issue

The line $newName = "$Destination$name" + '' + "$version" + '.zip' should be $newName = "$name" + '' + "$version" + '.zip'

The DSC configuration that is used to reproduce the issue (as detailed as possible)

# insert configuration here

The operating system the target node is running

OsName : Microsoft Windows Server 2019 Standard OsOperatingSystemSKU : StandardServerEdition OsArchitecture : 64-bit WindowsVersion : 1809 WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434 OsLanguage : en-US OsMuiLanguages : {en-US}

Version and build of PowerShell the target node is running

Name Value


PSVersion 5.1.17763.1490
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1490
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the DSC module that was used

9.1.0

lavanack avatar Jun 01 '21 06:06 lavanack

Still no fix ?

lavanack avatar Mar 29 '24 13:03 lavanack