Author Posts

I need to pull out all the Software update point in the Infra. Importing the module for sccm and using "Get-CMSoftwareUpdatePoint", gets me to the point where I get whats required. However the output is as below:-

SmsProviderObjectPath :

FileType              : 2

ItemName              :

ItemType              : System Resource Usage

NALPath               :

NALType               :

NetworkOSPath         : \\servername.domain.cc

PropLists             : {Objects Polled By Site Status}

Props                 : {AnonymousProxyAccess, DBServerName, Enabled, IsINF...}

RoleCount             : 7

RoleName              : SMS Software Update Point

ServerState           : 196611

ServiceWindows        :

SiteCode              :

SiteSystemStatus      : 1

SslState              : 0

Type                  : 2

I can pipe it to use "NetworkOSPath", but the output is \\servername.domain.cc. I want the output without \\ so that I can query it directly to the server.

example: servername.domain.cc

To what cmdlet are you planning to pipe it, If there is a cmdlet which accepts pipeline input for this NetworkOSPath by value/type it will work without any modifications. However for you query, you can do it in may ways, below are few.

```[system.uri]::new('\\servername.domain.cc').Host
'\\servername.domain.cc'.TrimStart('\\')
('\\servername.domain.cc' -split '\\')[-1]
```

From the question, I could guess that you need some basic learning in PowerShell, You can always start from
https://www.manning.com/books/learn-windows-powershell-in-a-month-of-lunches-second-edition

Thanks. I got this corrected using replace options.

\$computername= (Get-CMSoftwareUpdatePoint -allsite).NetworkOSPath -replace "\\"

Powershell, really vast. though i have gone through some tutorial. I tend to miss out here and there. Thanks for the link, I will go through it.

Depending on your learning style, you may also find some use out of the koans I'm working on:

https://www.github.com/vexx32/pskoans

Look for the Third Edition of the book, it's newer. http://donjones.com/powershell has a link. The 4N00bs book in particular might be helpful, as it's extremely concise (short read) and covers the major under-the-hood gotchas, like this, that trip people up the most.

And what you're likely looking for is Select-Object. What your command is producing isn't textual output; it's an object, which has properties. Select-Object lets you specify which ones you want included in the output.