using Regular expressions for registry path


hi friends

i creating script in 1 of steps, turns off ie esc in servers in test lab.so have write code following.

$mypath="registry::\hkey_local_machine\software\microsoft\active
setup\installed components\{a509b1a8-4b3f-8cfc-4f3a74704073}"
set-itemproperty-path$mypath-nameisinstalled-value0-force-verbose

but see registry path somehow long. want know possible use regex here shorten path?

for example suppose in path, after hklm there 1 key starts
"so", 1 ode starts "mi" , on. how can use regex
here create $mypath this:

$regpath = "registry::\hkey_local_machine\so*\mi*\ac*\in*\com*\{a50*

here writing asterisks * mean example because know, there 1
value at end of registry path starts {a50 simplicity
& avoiding typos, write initial characters.

in other words want tell system that:

at root of path: hkey_local_machine\  find key starts "so" & rest
characters can ( no matter because there is only 1 registry
starts "so" (software key)


thanks in advanced


monday, december 15, 2014 7:03 am

i think misunderstand regex for.  not path shrinker text parser.

you alos using longer form of path not necessary:

this:

mypath="registry::\hkey_local_machine\software\microsoft\active
setup\installed components\{a509b1a8-4b3f-8cfc-4f3a74704073}"

can this:

$mypath='hklm:\software\microsoft\active setup\installed components\{a509b1a8-4b3f-8cfc-4f3a74704073}' set-itemproperty-path $mypath -name isinstalled-value 0  

you can set location:

set-location 'hklm:\software\microsoft\active setup\installed components'

now list items

dir

you can set drive:

new-psdrive -name setup -psprovider registry -root 'hklm:\software\microsoft\active setup\installed components'

dir setup:



¯\_(ツ)_/¯



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client