File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 154154
155155 # Set the location where to save the diskpart command
156156 $diskpartScriptFile = Get-PSFConfigValue - FullName psdatabaseclone.diskpart.scriptfile - Fallback " $env: APPDATA \psdatabaseclone\diskpartcommand.txt"
157+
158+ if (-not (Test-Path - Path $diskpartScriptFile )){
159+ try {
160+ $null = New-Item - Path $diskpartScriptFile - ItemType File
161+ }
162+ catch {
163+ Stop-PSFFunction - Message " Could not create diskpart script file" - ErrorRecord $_ - Continue
164+ }
165+ }
157166 }
158167
159168 process {
Original file line number Diff line number Diff line change 164164
165165 # Set the location where to save the diskpart command
166166 $diskpartScriptFile = Get-PSFConfigValue - FullName psdatabaseclone.diskpart.scriptfile - Fallback " $env: APPDATA \psdatabaseclone\diskpartcommand.txt"
167+
168+ if (-not (Test-Path - Path $diskpartScriptFile )){
169+ try {
170+ $null = New-Item - Path $diskpartScriptFile - ItemType File
171+ }
172+ catch {
173+ Stop-PSFFunction - Message " Could not create diskpart script file" - ErrorRecord $_ - Continue
174+ }
175+ }
167176 }
168177
169178 process {
Original file line number Diff line number Diff line change 390390
391391 # Set the path to the diskpart script file
392392 Set-PSFConfig - Module PSDatabaseClone - Name diskpart.scriptfile - Value " $env: APPDATA \psdatabaseclone\diskpartcommand.txt" - Validation string
393+ New-Item - Path " $env: APPDATA \psdatabaseclone" - ItemType Directory
393394 Get-PSFConfig - FullName psdatabaseclone.diskpart.scriptfile | Register-PSFConfig - Scope SystemDefault
394395
395396 # Check if all the settings have been made
You can’t perform that action at this time.
0 commit comments