Select-String after line break - powershell

I want to extract the ID from this command:
manage-bde -protectors c: -get
The result of this command is:
Volume C: [Windows]
Tous les protecteurs de clés
Mot de passe numérique :
ID : {XXXXXXX-A315-42C6-9754-XXXXXXXXXX}
Mot de passe :
XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX
TPM :
ID : {XXXXXX-99B3-481B-B3FA-XXXXXXXXXXX}
Profil de validation PCR :
7, 11
(Utilise le démarrage sécurisé pour la validation d’intégrité.)
I want only the ID from the "Mot de passe numérique" (first one, but on some PC, it's the second one) and not the "TPM"
I tried to do that with select-string, but it return both :/
Is there a way to "tell" to select-string to print only the ID after the "mot de passe numérique" expression ?
Thx :)

Use Select-String's -Context parameter to indicate that you're interested in the lines surrounding a match:
$mbdeOutput = manage-bde -protectors c: -get
$mbdeOutput |Select-String 'Mot de passe numérique :' -Context 0,1 |ForEach-Object { $_.Context.PostContext[0] }
This should output the line immediately following Mot de passe numérique :

Related

Créer une hiérarchie dans un filtre sous Tableau [closed]

Closed. This question is not written in English. It is not currently accepting answers.
Stack Overflow is an English-only site. The author must be able to communicate in English to understand and engage with any comments and/or answers their question receives. Don't translate this post for the author; machine translations can be inaccurate, and even human translations can alter the intended meaning of the post.
Closed 6 days ago.
Improve this question
Bonjour,
J'aimerais pouvoir créer dans un filtre des regroupements que je pourrais développer ou réduire sur le même principe qu'une hiérarchie.
Par exemple : dans une colonne VEGE, j'ai la liste carottes, courgettes, celeri,banane, ananas, abricot...j'aimerais dans le filtre VEGE pouvoir regrouper carottes, courgettes et celeri sous légumes et le reste sous fruits avec la possibilité de déployer les groupes dans le filtre.
j'ai tenté une hiérarchie mais je n'arrive pas à la en filtre et ce n'est finalement pas le résultat attendu, j'ai continué sur la piste avec la création d'ensemble mais je fais chou blanc.
Merci pour votre aide

WhatsApp Templates and Error 63016 triggering a lot -- are new lines a problem?

I am using some WhatsApp templates associated with my number. But I am having mixed success in getting them to work without Error 63016. I create 9 templates, and 8 of them are getting the Error, which means that they are not matching the message I am sending with the template.
They do not work either if I execute them through Flow, or through Python (Rest API).
I have tried deleting and re-submitting the same template, and it failed again.
This is bothering me because testing out 9 templates and re-submitting them is laborsome.
Any ideas what m
Template #1, works fine:
Olá {{1}},
Nós vamos novamente te fazer algumas perguntas sobre seus hábitos de
consumo de notícias nas últimas semanas
São poucas perguntas, e as respostas são simples, como “Sim” ou “Não”.
Não deve levar mais de 2 minutos do seu tempo para responder à todas
as perguntas.
Quando estiver pronto para responder, mande qualquer mensagem nessa
conversa, como “Estou pronto”, ou clique no botão abaixo.
Template #2, not working:
Olá {{1}},
Nós vamos te fazer algumas perguntas sobre alguns fatos políticos que
aconteceram nas últimas semanas.
São poucas perguntas, e as respostas são simples, como “Sim” ou “Não”.
Não deve levar mais de 2 minutos do seu tempo para responder à todas
as perguntas.
Quando estiver pronto para responder, mande qualquer mensagem nesse
chat, como “Estou pronto”, ou clique no botão abaixo.

The command Get-InstalledApps doesn't work (Powershell)

I'm trying to list all the apps and programs installed on my computer. The comand Get-InstalledApps it's supossed to work but I get this response:
Get-InstalledApps : El término 'Get-InstalledApps' no se reconoce como nombre de
un cmdlet, función, archivo de script o programa ejecutable. Compruebe si
escribió correctamente el nombre o, si incluyó una ruta de acceso, compruebe que
dicha ruta es correcta e inténtelo de nuevo.
En línea: 1 Carácter: 1
+ Get-InstalledApps
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-InstalledApps:String) [], Com
mandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have already tried to google it, but i'm not capable of solving it.

Get parameter of a specific Simulink Block and compare it, Matlab

I'm parsing a text file with matlab which looks like this :
[Date]
2019-03-27 10:45:10.167618
[Component]
Component_Name : Manager principal
Component_ID : _ocl_MEu9Eemg_bhrv2HEbw
{Port}
Port_Name : FOP 1
Port_ID : _sZMXoEu9Eemg_bhrv2HEbw
Port_Type : Outgoing Port
[Component]
Component_Name : Manager 2
Component_ID : _r-HlMEu9Eemg_bhrv2HEbw
{Port}
Port_Name : FIP 1
Port_ID : _sZWIoku9Eemg_bhrv2HEbw
Port_Type : Incoming Port
[Link]
Link_Name : On/Off
Link_ID : _sZfSkku9Eemg_bhrv2HEbw
Link_Source_Name : Manager principal
Link_Source_ID : _ocl_MEu9Eemg_bhrv2HEbw
Link_Source_Port_Name : FOP 1
Link_Source_Port_ID : _sZMXoEu9Eemg_bhrv2HEbw
Link_Target_Name : Manager 2
Link_Target_ID : _r-HlMEu9Eemg_bhrv2HEbw
Link_Target_Port_Name : FIP 1
Link_Target_Port_ID : _sZWIoku9Eemg_bhrv2HEbw
I create a systeme for each [Component] i find and in each systems i create an input or output if the [Component] is a Source or a Target of a [Link].
In my text file example : On/Off is a link between 'Manager principal' and 'Manager 2'. So in the first System (Manager principal) i have an output called On/Off with a specific tag in tag description i set and in the second system (Manager 2) an input called On/Off with a specific tag in the Block tag i set.
So when i launch my code i have 2 system with 1 block in each system.
In this 2 blocks, if it's about the same link (in this example it is) we have this tag :
#_sZMXoEu9Eemg_bhrv2HEbw ==> #_sZWIoku9Eemg_bhrv2HEbw
The ID of the source port ==> the ID of the target port
This is what distinguish a Link than an other.
The context is : if the user change only the name of the Link for example Off/On instead of On/Off it must not create a new block because it's the same Link. So i would like to make a findBlocks() and for each blocks in the current system, i would like to do : if both ID's in tag description are same than in the text file so we just update the name of the block for example .
Here is the code where i create my blocks :
Update : I success to recover C which is the string inside Block tag.
B = find_system(sprintf('%s', component_NameValue));
C = get_param(find_system(sprintf('%s/%s', component_NameValue, link_NameValue)), 'Tag');
if (compareOut == 1) && (compareSource == 1) % Si c'est un port sortant et que c'est le port source du link
add_block('simulink/Ports & Subsystems/In1',[component_NameValue '/' link_NameValue]); % alors on ajoute un block Output de même nom que le link dans le système du composant que l'on parse
linkDescription = sprintf('Link : \n\n%s ==> %s \n\nComposant : \n\nDe : %s (%s) \nVers : %s (%s) \n\nPort Source : \n\n%s \n%s \n\n', link_NameValue , link_IDValue , link_SourceNameValue , link_SourceIDValue, link_TargetNameValue , link_TargetIDValue, link_SourcePortNameValue, link_SourcePortIDValue);
linkTag = sprintf('#%s ==> #%s', link_SourcePortIDValue, link_TargetPortIDValue);
set_param(gcb, 'Tag', linkTag);
set_param(gcb,'Description',linkDescription); % On ajoute une description au block contenant les infos du lien en question contenus dans le fichier texte
end
if (compareIn == 1) && (compareTarget == 1) % Si c'est un port entrant et que c'est le port target du link
add_block('simulink/Ports & Subsystems/Out1',[component_NameValue '/' link_NameValue]); % alors on ajoute un block Input de même nom que le link dans le système du composant que l'on parse
linkDescription = sprintf('Link : \n\n%s ==> %s \n\nComposant : \n\nDe : %s (%s) \nVers : %s (%s) \n\nPort Target : \n\n%s \n#%s', link_NameValue , link_IDValue , link_SourceNameValue , link_SourceIDValue, link_TargetNameValue , link_TargetIDValue,link_TargetPortNameValue, link_TargetPortIDValue);
linkTag = sprintf('#%s ==> #%s', link_SourcePortIDValue, link_TargetPortIDValue); %On ajoute un # devant l'ID du port pour pouvoir le retrouver et voir si un port à été modifié/rajouté/supprimé
set_param(gcb, 'Tag', linkTag);
set_param(gcb,'Description',linkDescription); % On ajoute une description au block contenant les infos du lien en question contenus dans le fichier texte
end
Thanks for helping in advance

How to create a template file for org-capture in Spacemacs?

I use a template file to capture a list of books. However last night, after wipe my old installation of spacemacs, when i try to capture a new book, it was impossible. I saw in capture buffer "Invalide Capture Template"
My org-capture-templates configuration is:
(setq org-capture-templates
'(("r" ; touche pour rentrer une référence
"Réference livre" ; on indique que l'on rentre la référence du livre
entry (file+datetree+prompt "~/git/org/Liste_Livres.org") ; On sauve la référence dans le fichier associé.
file "~/git/org/tpl-Liste-Livres.org" ) ; on utilise le template associé au fichier
("l" ; touche pour ajouter une entrée du lycée
"Journal Lycée" ; on indique que l'on rentre la référence du livre
entry (file+datetree "~/git/org/Journal_Lycee.org" ) ; On sauve l'entrée du journal dans le fichier associé.
"* %? %^g") ; on utilise le template pour la note à ajouter
("n" ; touche pour ajouter une note
"Notes" ; on indique que l'on rentre la référence du livre
entry (file "~/git/org/Notes.org" ) ; On sauve la note dans le fichier associé.
"* %? %t %^g \n :PROPERTIES:\n :LIEN: %i %a \n :END:") ; on utilise le template pour la note à ajouter
)
)
My tpl-Liste-Livres.org is:
* Titre :tags:
:PROPERTIES:
:Titre:
:Auteur:
:Pages:
:Editeur:
:Type:
:Sujet:
:Résumé:
:Prets:
:Lien:
:Lu:
:Acheté:
:ISBN:
:END:
I use emacs 25.1.1 from debian stable and spacemacs 0.300 develop
It looks like your targets are out of date with the newest version of org-mode. file+datetree is deprecated, and has been replaced with file+olp+datetree with some new properties to control the datetree type and prompt options. Current templates are documented here
(Note also that your reference book target file+datetree+prompt is also out of date, and would need to be replaced with the file+olp+datetree target, and the new :time-prompt property.)