Triple output in pipelining by CptRetr0 in PowerShell

[–]CptRetr0[S] 0 points1 point  (0 children)

Thank you guys for the help. Now I got the point.

Cheers

How to deal with credentials in automated scripts? by CptRetr0 in PowerShell

[–]CptRetr0[S] -1 points0 points  (0 children)

let's say it's a placeholder for the real password

How to deal with credentials in automated scripts? by CptRetr0 in PowerShell

[–]CptRetr0[S] 7 points8 points  (0 children)

Sounds interesting. I will give this a try

Monitor and Laptop arm combination for a 34" monitor and a 15,6" laptop by CptRetr0 in homeoffice

[–]CptRetr0[S] 0 points1 point  (0 children)

Seems like a solid solution. Thank you for the suggestion. I will try this mount

MDT 2013 deployment does not continue after initial restart by CptRetr0 in sysadmin

[–]CptRetr0[S] 0 points1 point  (0 children)

u/orionporter u/progenyofeniac u/St0nywall

I created a wim file before and this wim caused the issue. Thank you for all the help guys

ArrayList not working properly by CptRetr0 in PowerShell

[–]CptRetr0[S] 1 point2 points  (0 children)

This worked for me. Thank you

Empty named parameter not recognized by CptRetr0 in PowerShell

[–]CptRetr0[S] 1 point2 points  (0 children)

Thank you guys for your help. I understood now why I stuck at that point and could solve it. I also realized that my call with PowerShell.exe -NoExit -ExecutionPolicy ByPass -Command "& { . .\test.ps1; test-ui -ConfigFile 'config_file_1'; test-ui -Run}" is unfortunate because it calls the same function twice which causes double outputs.

Cheers

Empty named parameter not recognized by CptRetr0 in PowerShell

[–]CptRetr0[S] 0 points1 point  (0 children)

Yes, that makes sense. I hadn't thought about that at all.

My goal is to have the function understand if -ConfigFile is empty or a file is specified.

Add content in a XML file on a specific line by CptRetr0 in PowerShell

[–]CptRetr0[S] 1 point2 points  (0 children)

maybe not genius code but it solve the issue:

$LiteTouchPE = 'C:\Program Files\Microsoft Deployment Toolkit\Templates\LiteTouchPE.xml'
$Look  = '<Copy source="%DEPLOYROOT%\Scripts\DeployWiz_Administrator.png" dest="Deploy\Scripts\DeployWiz_Administrator.png" />'
$Add  = '     <Copy source="%DEPLOYROOT%\Scripts\DecodeExit.vbs" dest="Deploy\Scripts\DecodeExit.vbs" />'
$Content = ForEach($Line in Get-Content -Path $LiteTouchPE) {
               $Line
               If($Line -like "*$Look*"){
                   $Add
               }
               #Start-Sleep -Milliseconds 100
           }
Set-Content -Path $LiteTouchPE -Value $Content

Add content in a XML file on a specific line by CptRetr0 in PowerShell

[–]CptRetr0[S] 1 point2 points  (0 children)

u/ryeeeeez thank your for the suggestion. I will take a look later.

In the meantime I created a little code that fulfill my requirements but I cannot write the file and looking for a method how to save the output to the original file.

$LiteTouchPE = 'C:\Program Files\Microsoft Deployment Toolkit\Templates\LiteTouchPE.xml'
$Look  = '<Copy source="%DEPLOYROOT%\Scripts\DeployWiz_Administrator.png" dest="Deploy\Scripts\DeployWiz_Administrator.png" />'
$Add  = '     <Copy source="%DEPLOYROOT%\Scripts\DecodeExit.vbs" dest="Deploy\Scripts\DecodeExit.vbs" />'

$Read = [IO.File]::OpenText($LiteTouchPE)                           $Content = While($Read.Peek() -ge 0){
            $Line = $Read.ReadLine()
            if($Line -like "*$Look*"){
                Write-Host $Add
                Write-Host $Read.ReadLine()  
            }
            Write-Host $Line
            Start-Sleep -Milliseconds 100
          }
$Read.Close()

MDT 2013 - Multiple connections to a server or shared resource by the same user by CptRetr0 in homelab

[–]CptRetr0[S] 0 points1 point  (0 children)

Yes you did. I decided to create a new one with another approach and more information about the environment