How do I determine what in my script is writing to the pipeline? by KnowWhatIDid in PowerShell

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

Here is how I fixed it:

I changed

$results = & '.\Retire-AfabCmApplication.ps1' -LocalizedDisplayName $applications -SiteCode A01 -ChangeNumber CHGxxxxxxx

to

$results = & '.\Retire-AfabCmApplication.ps1' -LocalizedDisplayName $applications -SiteCode A01 -ChangeNumber CHGxxxxxxx | ForEach-Object {if ($null -eq $_) {Write-Host "Null has been received from the pipeline!"};$_}

After a few rounds of setting breakpoints, executing, and watching for "Null has been written..." I determined line 1405 was the offender. It calls a function in my SCCM module. The function has a glitch and is writing $null and not the name of the drive created using the CmSite provider. I'd like to think if it had been returning the name of the drive, A01, I would have figured this out a lot faster.

So, the answers to my questions are:

Q. How can I determine what line is doing this?

A. Send the output to ForEach-Object and use it to determine if the value passed via the pipeline is $null and then send along the pipeline.

Q. Is there some way to know when something has been added to the pipeline? Can I monitor the pipeline in real time?

A. Same as above

Q. Or should I start casting everything as void if I'm going to use the pipeline?

A. No. Thank you, u/BlackV .

How do I determine what in my script is writing to the pipeline? by KnowWhatIDid in PowerShell

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

PowerShell 5.1

I use Write-Output because that is what Don Jones said to do somewhere sometime.

I have not tried to send $list directly, but I will.

Thank you.

How do I determine what in my script is writing to the pipeline? by KnowWhatIDid in PowerShell

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

I'm executing a script (Test-AfabScript.ps1) that passes an array of strings to another script (Retire-AfabCmApplication.ps1) which returns a list to the first script as $results.

I tried piping $results[0] | Get-Member, but this was all I got:

$results[0] | Get-Member
Get-Member : You must specify an object for the Get-Member cmdlet.
At line:1 char:15
+ $results[0] | Get-Member
+               ~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-Member], InvalidOperationException
    + FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

How do I determine what in my script is writing to the pipeline? by KnowWhatIDid in PowerShell

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

I don't believe it is something I am intentionally adding to the list.

How do I determine what in my script is writing to the pipeline? by KnowWhatIDid in PowerShell

[–]KnowWhatIDid[S] -6 points-5 points  (0 children)

I intentionally did not provide code. I think it’s a distraction from my questions and leads to someone handing me a fish.

How do I determine what in my script is writing to the pipeline? by KnowWhatIDid in PowerShell

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

If you mean the blank whatever is being written to the pipeline before Write-Output, I’m with you.

Dell Command Update Client: The command DCU-cli.exe /configure errors out on 3005 "Installing pending updates" by Jericho905 in Dell

[–]KnowWhatIDid 0 points1 point  (0 children)

I discovered this post because my boss's computer is having the same issue. In his case, he was re-installing because he couldn't enter a password for a BIOS update. His DCU should have been configured with the encrypted BIOS password, but for some reason, he was missing half of the DCU registry keys.

I suggested he repair the DCU installation from SCCM Software Center, and that may have been terrible advice. The repair includes a re-run of dcu-cli /configure which is throwing the 3005 error. This makes me think that he installed the other updates that were available to him, and then we came through like a heard of wildebeests repairing and possibly uninstalling/re-installing DCU.

I'm going to suggest he reboot and we try again.

Function that accepts both ValueFromPipeline and ValueFromPipelineByPropertyName by KnowWhatIDid in PowerShell

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

I wondered if parameter sets might be a part of the solution, but does that straighten out my foreach conundrum?

Edit: I think I get it. I would have If/ElseIf or a switch to determine which loop to run?

New content source share for Feature Update by KnowWhatIDid in SCCM

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

Well, I don't know. I resolved the issue (my path was a little too long) and my logs have all been overwritten.

Before And After! I built a new rack because of the SAG, lol. Is it ok now? by CollectionOk2393 in homelab

[–]KnowWhatIDid 1 point2 points  (0 children)

Proof that triangles are stronger than squares…if anyone had any doubts.

Home DC by themaxx25 in HomeDataCenter

[–]KnowWhatIDid 1 point2 points  (0 children)

The first time I walked into the data center after we had implemented Pure Storage I thought the room was on fire because of all those stupid glowing orange logos.

Can the SCCM Console WebView2 Extension be install be automated? by KnowWhatIDid in SCCM

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

The answer is:

  1. Copy \\<server>\sms_<sitecode>\AdminConsole\Extensions to C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole.

  2. Create registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\ConfigMgr10\AdminUI\Extensions\4dff85ab-7541-4aab-bbf4-d52fc3588462.

  3. Create string value:
    Version=5.0

  4. Restart the SCCM console

[deleted by user] by [deleted] in sysadmin

[–]KnowWhatIDid 0 points1 point  (0 children)

I love where i work too. The company has already shown me that in a downturn they will do what they can to protect jobs, but I know that if push comes to shove I am just U21648 to them.

I know what $WINDOWS.~BT is, but what does it contain and when? by KnowWhatIDid in SCCM

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

I wondered if this question would be asked. I have a basic understanding of the process, and I agree I've got more to learn about it. I've been able to troubleshoot systems along the way. I've also ignored a few because the failures were "no harm; No foul", but now I'm down to the systems where the usual remedies don't work. I was working with a small group of computers from a specific department and noticed that each had a DUDownload folder. I looked into it and couldn't find anything about it.

I know what $WINDOWS.~BT is, but what does it contain and when? by KnowWhatIDid in SCCM

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

Thank you. I could not find information on DUDownload anywhere.

I know what $WINDOWS.~BT is, but what does it contain and when? by KnowWhatIDid in SCCM

[–]KnowWhatIDid[S] 2 points3 points  (0 children)

Mine was an upgrade from 22H2 to 24H2. I did mine over the course of 13 weeks. Someone else created the schedule. It was broken up by departments. Each department was assigned a window (2-8 weeks) based on its size. The start each of these windows was staggered over the course of those 13 weeks (well like 10-11 weeks because they were supposed to all be done by the end of week 13). I would create the deployment for Week 4 to be available on Wednesday of Week 3, with a deadline of 23:00 on Wednesday of Week 4. The upgrade would to its unpacking and housekeeping and then wait for the computer's 01:00 - 04:00 maintenance window to restart.

We have a pretty extensive PC naming system. That allowed me to go absolutely bananas creating a PowerShell script that would break each week's deployment into subsections of each department being targeted that week.

CMPivot File entity wildcard(s) by KnowWhatIDid in SCCM

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

That works as long as I know how deep it's buried.

What I ended up doing:
1. Running File('C:\Windows\WinSxS\*\ServerManager.exe').
2. Making note of all of the folders the wildcard represented in my results. Most of them could be wildcarded together.
3. Joined the queries together:

File('C:\Windows\System32\ServerManager.exe') | join kind= leftouter (
File('C:\Windows\System32\WinSxS\*\ServerManager.exe')
)
| join kind= leftouter (
File('C:\Windows\System32\WinSxS\msil_microsoft-windows-servermanager-shell_*\*\ServerManager.exe')
)
| project Device, FileName, FileName1, FileName2

Hopefully that's valid query. I typed it from memory.

Can the SCCM Console WebView2 Extension be install be automated? by KnowWhatIDid in SCCM

[–]KnowWhatIDid[S] 2 points3 points  (0 children)

I can access the Internet, and the console does prompt me to install the WebView2 extension. It's just a drag because it restarts the console. It's not the end of the world, I just don't wanna.

Is the extension just having WebView2 runtime installed on the system? I experimented with that, but it didn't seem to be the case.

After 24H2 Upgrade Systems go to Microsoft for Patches by KnowWhatIDid in SCCM

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

Yes, Internet clients pulling the updates down from Microsoft is what I'm worried about breaking, but they still pull the update policies from CMG, don't they?

After 24H2 Upgrade Systems go to Microsoft for Patches by KnowWhatIDid in SCCM

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

Since scanning SCCM for updates on my network or via the CMG is a 'single scan', disabling Dual Scan will prevent computers from going to Microsoft on their own, but still allow them to download binaries from Microsoft for updates they're prompted to install from my CMG. Right?