Ive been working on this issue for 2 days now, and Im stumped. So I humbly come here hoping someone can help me out.
I am trying to write a powershell script that will setup Dell hardware to add an asset tag and property owner tag using cctk. Here is what I have written so far.
$prox86 = ${env:ProgramFiles(x86)}
$cctkpath = "$prox86\Dell\CCTK\X86_64\cctk.exe"
$assettag = "123456"
$proptag = "Property of My Company"
& cmd.exe /c $cctkpath "--asset=$assettag"
& cmd.exe /c $cctkpath "--propowntag=$proptag"
When I run the PS script, the asset tag portion works perfectly. The propowntag will not work when i include spaces. It comes back with an error that says..
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
For whatever reason those additional spaces in my $proptag variable seem to kill that line of code. if I change the property tag to soemthing like "test123", or anything without spaces, it will work correctly. I tried using the suggestions in the link below, but I couldnt get it to work. Any help would be greatly apprecaited.
How to Call CMD.EXE from PowerShell with a Space in the Specified Command's Directory Name