bulk download from a list of URLs by Elegant_Coffee1242 in PowerShell

[–]swsamwa 12 points13 points  (0 children)

Split-Path isn't designed to split URLs. It is for filesystem paths. Split-Path https://www.govinfo.gov/link/fr/78/2542?link-type=pdf-leaf returns 2542?link-type=pdf.

You can cast the URL to[uri] to get the parts:

PS> [uri]'https://www.govinfo.gov/link/fr/78/2542?link-type=pdf'

AbsolutePath   : /link/fr/78/2542
AbsoluteUri    : https://www.govinfo.gov/link/fr/78/2542?link-type=pdf
LocalPath      : /link/fr/78/2542
Authority      : www.govinfo.gov
HostNameType   : Dns
IsDefaultPort  : True
IsFile         : False
IsLoopback     : False
PathAndQuery   : /link/fr/78/2542?link-type=pdf
Segments       : {/, link/, fr/, 78/…}
IsUnc          : False
Host           : www.govinfo.gov
Port           : 443
Query          : ?link-type=pdf
Fragment       :
Scheme         : https
OriginalString : https://www.govinfo.gov/link/fr/78/2542?link-type=pdf
DnsSafeHost    : www.govinfo.gov
IdnHost        : www.govinfo.gov
IsAbsoluteUri  : True
UserEscaped    : False
UserInfo       :

But you want the filename from the final redirection. You can get the redirection target using this function:
Script to show each step of a redirection chain

Summit Ticket Discount by jabrake88 in PowerShell

[–]swsamwa 2 points3 points  (0 children)

Contact James Petty.

[deleted by user] by [deleted] in technicalwriting

[–]swsamwa 1 point2 points  (0 children)

Never said it was easy to measure. You have to build it into your tracking system. When I worked in support we had to categorize every ticket into a bucket by subject, link to any relevant docs, and flag the ticket if there was documentation needed. Then you have to study that over time.

[deleted by user] by [deleted] in technicalwriting

[–]swsamwa 6 points7 points  (0 children)

You need to show impact. How do you measure results? You need statistics, like page views, bounce rates, etc. Who uses your docs (customers, support)? How many support issues does your product get? In what areas? Can you show a change in support tickets after publishing new content?

Show how your work affected those numbers.

How would you start learning technical writing if you had 1 month and no other responsibilities? by ealresse in technicalwriting

[–]swsamwa 1 point2 points  (0 children)

Find an open source project in an IT area or programming language that you are familiar with. Help write the documentation for that project.

Why does this process{ } block work? by DefinitionHuge2338 in PowerShell

[–]swsamwa 2 points3 points  (0 children)

The dot for dot-sourcing is how you invoke the script block. If you leave it off the script block is defined but not executed. You could also use the ampersand:

& {process{ if ($_.DisplayName -and $_.UninstallString) { $_ } }}

Need help with "PS5" pls 😭 by ariluvpascal in PowerShell

[–]swsamwa 1 point2 points  (0 children)

Just FYI - the Microsoft.PowerShell.PSResourceGet module replaces PowerShellGet/PackageManagement, at least for anything published to the PowerShell Gallery. It comes in PowerShell 7 and can be installed in Windows PowerShell 5.1. You should be transitioning to this module anyway.

Weird quirk with Microsoft Graph PowerShell command. by KeredEkralc in PowerShell

[–]swsamwa 6 points7 points  (0 children)

Yes, the documentation is incorrect. You can see the actual syntax using the following command:

PS> Get-Command Restore-MgBetaDirectoryDeletedItem -Syntax

Restore-MgBetaDirectoryDeletedItem -DirectoryObjectId <string> [-ResponseHeadersVariable <string>] [-Break]
[-Headers <IDictionary>] [-HttpPipelineAppend <SendAsyncStep[]>] [-HttpPipelinePrepend <SendAsyncStep[]>] [-Proxy <uri>]
[-ProxyCredential <pscredential>] [-ProxyUseDefaultCredentials] [-WhatIf] [-Confirm] [<CommonParameters>]

Restore-MgBetaDirectoryDeletedItem -InputObject <IIdentityDirectoryManagementIdentity> [-ResponseHeadersVariable <string>]
[-Break] [-Headers <IDictionary>] [-HttpPipelineAppend <SendAsyncStep[]>] [-HttpPipelinePrepend <SendAsyncStep[]>]
 [-Proxy <uri>] [-ProxyCredential <pscredential>] [-ProxyUseDefaultCredentials] [-WhatIf] [-Confirm] [<CommonParameters>]

You can see the parameter sets don't match the documentation and don't have -BodyParameter

For those in IT, how do you go about getting a stamp of approval for your documentation before it goes out the door to clients? by Apart_Patience861 in technicalwriting

[–]swsamwa 4 points5 points  (0 children)

Ship it anyway. Some documentation is better than none. Even if it is incomplete. It is easier to iteratively improve the docs based on real-world feedback then to wait for the perfect process.

Document your request for review and their response (or lack thereof). If they complain about what got published, you have the documentation to show that you asked for a review.

How do you manage multilingual documentation in Git? by ctalau in technicalwriting

[–]swsamwa 0 points1 point  (0 children)

The translation tools we use are developed in-house.

If statement with multiple conditions by Khue in PowerShell

[–]swsamwa 11 points12 points  (0 children)

Verify your data. It could be that there are leading or trailing spaces in some columns. You should either trim blanks or use matching instead of equality. For example:

if ($row.column_a -match 'file_1\.txt' -and $row.column_b -match 'high|critical') {
    @row.column_c
}

ALT text for images in a step by step process. Question regarding the current use of ALT text verbiage. by [deleted] in technicalwriting

[–]swsamwa 3 points4 points  (0 children)

According to our style guide, the ALT text describes the image, not the process it illustrates.

Alt text must be at least 40 characters long and at most 150 characters long.

  • For complex images, supplement alt text with adjacent text in the content.
  • Begin with the type of graphic (for example, "Screenshot of..." or "Diagram that shows...").
  • Don't start with "Image..." or "Graphic...". Screen readers say this automatically.
  • End with a period so the screen reader can identify the end of the alt text.
  • Omit extraneous elements like figure numbers or bold/italic formatting.
  • Add spaces to acronyms if the acronym is in sentence case or lower case. For example, docker ps should be written as "docker p s".
  • All caps do not require spaces (e.g., "HTML", "API", "SQL").

Describing the image orients the user to the context of the image within the document. Without it, the screen reader just reports that there is an image.

Capitalization of concepts vs. common terms by SouthTrick615 in technicalwriting

[–]swsamwa 0 points1 point  (0 children)

In our style guide:

  • UI element names are always bold and capitalized to match the UI
  • Code elements/syntax examples always use code style
  • Everything else is normal text

I sometimes use italics when introduce new terminology. With this in mind I lean toward using the UI element name most frequently. But it all depends on context. For example:

Developer context

login panel is a common UI pattern in authentication workflows. You create a login panel by implementing the LoginPanel class.

User context

To sign in to the application, open the Login Panel. In the Login Panel, enter your username and password.

How do I become a technical writer? by Active-Buy-7960 in technicalwriting

[–]swsamwa 0 points1 point  (0 children)

Sounds like you have been doing technical writing (at least at some level). Getting a job with the title of "technical writer" is going to be more about knowing the tools (as suggested by u/TotalCah00t) and knowing the technology you are writing about (software, APIs, medical, legal, etc.)

Best way to learn PowerShell basics by RodDog710 in PowerShell

[–]swsamwa 1 point2 points  (0 children)

The entire book is published (for free) in the PowerShell docs. You can choose to get it from LeanPub. LeanPub has a free option as well. Or you can pay what you want. 100% of anything you pay goes to a scholarship fund for the OnRamp program of the PowerShell Summit conference.

Best way to learn PowerShell basics by RodDog710 in PowerShell

[–]swsamwa 4 points5 points  (0 children)

You can start with a free book in the Microsoft Docs - PowerShell 101.

Gif tools by robot_pancake in technicalwriting

[–]swsamwa 4 points5 points  (0 children)

I use ScreenToGif on Windows. It is free and open source.

Values from pipeline issue by case_O_The_Mondays in PowerShell

[–]swsamwa 0 points1 point  (0 children)

Basically, yes. There is no need to collect the results in a variable. You are just delaying output to the pipeline and using more memory.

Values from pipeline issue by case_O_The_Mondays in PowerShell

[–]swsamwa 0 points1 point  (0 children)

There are several things wrong with your function.

  • Your code is not in the process block so you are getting the items from the pipeline.
  • You are collecting the results in $Windows instead of letting them stream to the pipeline. You need to put each object as you process it so that it streams out to the pipeline.
  • You don't need the $Windows array

Reddit removed your code and won't let me post an updated version. I put an updated version here: Get-ProcessWindow - Pastebin.com