2 Answers
- Newest
- Most votes
- Most comments
0
you need to wrap variable with backticks. I also ran into this issue and to troubleshoot you just go to the location of the script on the host and look at the script, you'll notice with how you have it, if you look at the script (c:\programdata\amazon\ssm{instanceId}\document\orchestration{orchestrationID}\awsrunPowerShellScript\0.awsrunPowerShellscript_script.ps1) the variable doesnt even show up left of the equal sign.
so just wrap like `$DiskNumber` = (get-partition...).. Then open the script from path and look at it to troublshoot further.
answered 2 years ago
0
this is the error I am seeing. With or without back ticks
Get-Partition : Cannot validate argument on parameter 'DriveLetter'. The argument is null. Provide a valid value for
the argument, and then try running the command again.
At C:\ProgramData\Amazon\SSM\InstanceData\i-0c02b9986c3c33057\document\orchestration\e4a27d78-e4ae-4fae-b45f-f528729b81
dc\awsrunPowerShellScript\0.awsrunPowerShellScript\_script.ps1:1 char:45
+ `$DiskNumber` = (Get-Partition -DriveLetter $driveletter).DiskNumber
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Partition], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-Partition
$Size = : The term '$Size =' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\ProgramData\Amazon\SSM\InstanceData\i-0c02b9986c3c33057\document\orchestration\e4a27d78-e4ae-4fae-b45f-f528729b81
dc\awsrunPowerShellScript\0.awsrunPowerShellScript\_script.ps1:3 char:1
+ `$Size` = Get-PartitionSupportedSize -DriveLetter $driveletter
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: ($Size =:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Resize-Partition : Cannot validate argument on parameter 'DriveLetter'. The argument is null. Provide a valid value
for the argument, and then try running the command again.
At C:\ProgramData\Amazon\SSM\InstanceData\i-0c02b9986c3c33057\document\orchestration\e4a27d78-e4ae-4fae-b45f-f528729b81
dc\awsrunPowerShellScript\0.awsrunPowerShellScript\_script.ps1:4 char:31
+ Resize-Partition -DriveLetter $driveletter -Size $Size.SizeMax
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Resize-Partition], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Resize-Partition
answered a year ago
Relevant content
- asked 19 days ago
- asked 2 years ago
- asked 4 years ago
- asked 4 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago