I have seen this done in other languages, but I have not been able to achieve this yet in PowerShell.
I am attempting to read in a device's HardwareID for importing into Azure. The HardwareID variable is 4096 characters, and I can only store a max of 1024 characters per variable in this program....
is there a clean way to break a random-character 4096 string into equal 1024 char parts?
I have tried using regex, with the split-string command, and with the -spilt option, but I don't know enough regex to get a working query...
$devDetail = Get-CimInstance -NAmespace root/cimv2/mdm/dmmap -ClassName MDM_DevDetail_Ext01 -Filter "InstanceID='Ext' AND ParentID='./DevDetail'"
$devDetail.DeviceHardwareData -split "^.{1,1024}$"
That doesn't seem to work like I hoped... Any awesome hints for me to get this working?
Note:
- $devDetail.DeviceHardwareData is a random char string, I am unable to split this on a specific pattern or character, which I think the Split command was designed to be used for...