|
Antigravitas posted:Bingo. It's a new day, just got into the office, did a git diff on a lark, and found this piece of code within the module: Surprised that imported at all what with a glaring syntax error. Also I hope the module you're developing is only a collection of functions and nothing more.
|
# ? Jan 23, 2020 10:08 |
|
|
# ? May 15, 2024 23:26 |
|
It imports without any error whatsoever, indeed. And yes, it's basically just some wrapper functions around the actual logging code that's written in a sane language.
|
# ? Jan 23, 2020 10:28 |
|
Does anyone know if it's possible to force O365 to sync with AD? I've got a script to provision an AD user, but I can't provision their service licensing until MSOL gets around to refreshing, which can be up to 30 minutes. I searched around and didn't see anything, but I figured I'd ask.
|
# ? Jan 23, 2020 12:26 |
|
PierreTheMime posted:Does anyone know if it's possible to force O365 to sync with AD? I've got a script to provision an AD user, but I can't provision their service licensing until MSOL gets around to refreshing, which can be up to 30 minutes. I searched around and didn't see anything, but I figured I'd ask. From what you describe I'm assuming you're allocating licenses via groups in Azure AD and are syncing on-prem AD to Azure AD via AADC. If that's the case you can trigger an AADC sync cycle manually by running Start-ADSyncSyncCycle -PolicyType Delta from your AADC server. Edit: it's not a good idea to run manual syncs super frequently as they can start backing-up.
|
# ? Jan 23, 2020 13:13 |
|
Pile Of Garbage posted:From what you describe I'm assuming you're allocating licenses via groups in Azure AD and are syncing on-prem AD to Azure AD via AADC. If that's the case you can trigger an AADC sync cycle manually by running Start-ADSyncSyncCycle -PolicyType Delta from your AADC server. It’s for a team that gets 3-4 user adds per day, so it shouldn’t be too bad. Thanks for the quick response, I’ll give it a shot.
|
# ? Jan 23, 2020 13:25 |
|
PierreTheMime posted:It’s for a team that gets 3-4 user adds per day, so it shouldn’t be too bad. Thanks for the quick response, I’ll give it a shot. You can modify the sync schedule, default is 30 minutes: https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-sync-feature-scheduler I'd recommend batching user adds if at all possible. Maybe establish a process where all currently requested users are processed at set times throughout the day? The last customer I supported who ran AADC with O365 had their on-prem user provisioning automated by CA IAM which was triggered by SAP integrations. HR would request users via SAP and provisioning ran at midnight so users would always be ready to go by start-of-business. It was a giant fuckin pile of garbage (Especially the CA IAM stuff) but it worked like a charm. Pile Of Garbage fucked around with this message at 15:44 on Jan 23, 2020 |
# ? Jan 23, 2020 15:39 |
|
Pile Of Garbage posted:You can modify the sync schedule, default is 30 minutes: https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-sync-feature-scheduler The current ask I have is from an offshore client team that receives new user requests in the form on an Excel spreadsheet and they're driven by SLA and all that fun to get them done as soon as possible. So I've got a script that sorts their users into an OU bucket, applies various groups, sets their access, and then has the capability to provision licensing but as discussed has to wait for that. They also have a mess of other bespoke third party services they want included but most don't have an API so they're SOL on that angle; they've gone the route of having a "robotic process automation" scripted event to mouse-click their way through the other stuff.
|
# ? Jan 23, 2020 15:51 |
|
Powershell more like Powers Hell, amirite?
|
# ? Jan 23, 2020 16:31 |
|
PierreTheMime posted:The current ask I have is from an offshore client team that receives new user requests in the form on an Excel spreadsheet and they're driven by SLA and all that fun to get them done as soon as possible. So I've got a script that sorts their users into an OU bucket, applies various groups, sets their access, and then has the capability to provision licensing but as discussed has to wait for that. They also have a mess of other bespoke third party services they want included but most don't have an API so they're SOL on that angle; they've gone the route of having a "robotic process automation" scripted event to mouse-click their way through the other stuff. that sounds just like the setup I described: the SAP to CA IAM integration was literally just SAP HRIS writing a CSV to an SMB share and then CA IAM ingests that file, reconciles it against its own databases and then does the needful in AD. poo poo's a minefield of garbage, good luck. Edit: oh yeah make sure to appropriately adjust the sync scope of AADC so that it only includes containers/OUs that you need to sync. By default it'll sync all containers/OUs in the domain which is cooked and well worth adjusting. Antigravitas posted:Powershell more like Powers Hell, amirite? I prefer PissHell Pile Of Garbage fucked around with this message at 17:27 on Jan 23, 2020 |
# ? Jan 23, 2020 17:24 |
|
Ok this is probably a dumb question that I am not googling correctly but: Is there a way I can get the Exchange Online cmdlets to populate in VSCode so I can tab-complete them/the parameters while working on scripts? For example Get-CalendarProcessing or Get-User and the like?
|
# ? Jan 24, 2020 23:09 |
|
Inspector_666 posted:Ok this is probably a dumb question that I am not googling correctly but: Is there a way I can get the Exchange Online cmdlets to populate in VSCode so I can tab-complete them/the parameters while working on scripts? For example Get-CalendarProcessing or Get-User and the like? I tried it just now. After running Install-Module ExchangeOnline from PowerShell, Intellisense includes the module's cmdlets in VSCode without any additional configuration. Do you have the PowerShell extension installed in VSCode?
|
# ? Jan 24, 2020 23:35 |
|
Toast Museum posted:I tried it just now. After running Install-Module ExchangeOnline from PowerShell, Intellisense includes the module's cmdlets in VSCode without any additional configuration. Do you have the PowerShell extension installed in VSCode? Yep, that did it. I knew it was something dumb I wasn't thinking of. I seldom use the integrated PS terminal so I always forget about it.
|
# ? Jan 24, 2020 23:41 |
|
Hope this is the right place, I just got tasked with learning powershell and using it in our environment. Does anyone know a good place to start off?
|
# ? Jan 28, 2020 20:00 |
|
Powershell in a month of lunches is widely recommended
|
# ? Jan 28, 2020 20:11 |
|
Fhistleb posted:Hope this is the right place, I just got tasked with learning powershell and using it in our environment. It really depends on what exactly you’re looking to do, as it’s a fairly broad language. Generally Microsoft’s own documentation is very solid. There’s a good number of tutorials out there; what are you planning to use it for?
|
# ? Jan 28, 2020 20:12 |
|
The resources on Pluralsight are all great too. The channel 9 team did a good jump start series on powershell 3 awhile back. Powershell 3 is a few versions old but the basics of the language itself havent changed that much since then.
|
# ? Jan 28, 2020 20:15 |
|
adaz posted:The resources on Pluralsight are all great too. The channel 9 team did a good jump start series on powershell 3 awhile back. Powershell 3 is a few versions old but the basics of the language itself havent changed that much since then. Coming from an OOP angle I will say I’ve ended up using classes a lot and would recommend them if they suit your post v5 needs.
|
# ? Jan 28, 2020 20:17 |
|
PierreTheMime posted:Coming from an OOP angle I will say I’ve ended up using classes a lot and would recommend them if they suit your post v5 needs. Yeah fair - but technically classes have always existed they just added some syntax sugar around to make it easier to use inside the shell instead of falling back to more native .NET constructs. Always a good point (and not sure where Fhistleb is coming from) learning powershell is very different depending on your background. If you come from a C# .NET background it's very important to realize that under the hood you can just inline C# if you care to or use stuff like classes now. If you're a linux admin used to bash learning cmdlets / pipe syntax / powershell core is probably more important.
|
# ? Jan 28, 2020 20:20 |
|
PierreTheMime posted:It really depends on what exactly you’re looking to do, as it’s a fairly broad language. Generally Microsoft’s own documentation is very solid. There’s a good number of tutorials out there; what are you planning to use it for? One of the first things I was tasked with was moving archive logs to another server. I'm just going to jump from there.
|
# ? Jan 28, 2020 20:43 |
|
Fhistleb posted:One of the first things I was tasked with was moving archive logs to another server. I'm just going to jump from there. https://devblogs.microsoft.com/scripting/ The scripting guys blog is, in general, a great place for stuff like this. Few paragraphs on how to do common powershelly things like moving files and so forth.
|
# ? Jan 28, 2020 20:48 |
|
adaz posted:https://devblogs.microsoft.com/scripting/ Awesome! Thank you!
|
# ? Jan 28, 2020 20:49 |
|
I think you meant to link this one. PowerShell Scripting in a Month of Lunches is by the same authors and also good, but it's a lot less introductory. I hope that both books get updated for PowerShell 7, but 5.1 is similar enough (and still so widespread) that it's not a huge loss just yet. One of the Month of Lunches authors (I forget which) also did a lot of the the PluralSight tutorials on PowerShell. I don't love video tutorials for this sort of thing, but the content is good, if that's a format that works for you. Whatever training resources you end up using, supplement it by trying to find ways to incorporate PowerShell into your actual work. Immediate applicability definitely helped the concepts stick for me.
|
# ? Jan 28, 2020 20:51 |
|
I really should update the OP with all this, a lot has changed since I started this thread.
|
# ? Jan 28, 2020 20:53 |
|
adaz posted:I really should update the OP with all this, a lot has changed since I started this thread. You could always.... start a new thread.
|
# ? Jan 28, 2020 20:55 |
|
Toast Museum posted:I think you meant to link this one. PowerShell Scripting in a Month of Lunches is by the same authors and also good, but it's a lot less introductory. I hope that both books get updated for PowerShell 7, but 5.1 is similar enough (and still so widespread) that it's not a huge loss just yet. You are correct, I was phone posting and didn't look closely.
|
# ? Jan 28, 2020 21:14 |
|
Toshimo posted:You could always.... start a new thread. I could've! but I did update the OP a bit with more up to date links. WIll add some better code examples too
|
# ? Jan 28, 2020 21:17 |
|
PierreTheMime posted:Coming from an OOP angle I will say I’ve ended up using classes a lot and would recommend them if they suit your post v5 needs. How do you tend to use them? PowerShell classes feel like a trap to me. I like them and use them where I can, but using them in modules is so poorly supported. I was hoping that PowerShell 7 would bring module manifests that can handle classes, but I haven't seen that in any changelogs. On the bright side, "gently caress it, I'll figure out how to make a compiled module" is why I'm starting to learn C#
|
# ? Jan 28, 2020 21:29 |
|
Toast Museum posted:How do you tend to use them? My needs are pretty simple, but for complex operations I find its helpful to organize related actions and encapsulate things into their appropriate place so you can return a resulting value or object with just what you want, hiding/discarding everything else. Passing multiple values around in a class is a lot simpler than functions, which is something I do often. I'm sure there's other things I can't think of at the moment, but I use them primarily because I have OOPoisoning and any time I look at scripts that require multiple steps I think "how can I make a class out of this".
|
# ? Jan 29, 2020 00:57 |
|
Trying to use Powershell as a general purpose programming language is a trap and classes are one example. When you are writing a Powershell class you enter the twilight zone between Powershell and writing a good language. The syntax is suddenly different and things are strongly-ish typed and that's a recipe for disaster. It's like you are suddenly writing a severely oxygen deprived C#. Just implement a type in C# and write the glue in Powershell.
|
# ? Jan 29, 2020 01:33 |
|
PierreTheMime posted:My needs are pretty simple, but for complex operations I find its helpful to organize related actions and encapsulate things into their appropriate place so you can return a resulting value or object with just what you want, hiding/discarding everything else. Passing multiple values around in a class is a lot simpler than functions, which is something I do often. I'm sure there's other things I can't think of at the moment, but I use them primarily because I have OOPoisoning and any time I look at scripts that require multiple steps I think "how can I make a class out of this". Nah, that all makes sense, and it's a lot of the same reasons I keep reaching for them. If I recall correctly, Microsoft introduced PowerShell classes mostly with DSC in mind, which I guess explains some of the weird feature gaps. Antigravitas posted:Trying to use Powershell as a general purpose programming language is a trap and classes are one example. When you are writing a Powershell class you enter the twilight zone between Powershell and writing a good language. The syntax is suddenly different and things are strongly-ish typed and that's a recipe for disaster. It's like you are suddenly writing a severely oxygen deprived C#. I can't really disagree, and I'm kinda kicking myself for not considering the hybrid approach you suggest. That can still represent a big jump in complexity, though. Like, trading Invoke-RestMethod for System.Net.Http feels like running into a wall.
|
# ? Jan 29, 2020 02:22 |
|
Toast Museum posted:Nah, that all makes sense, and it's a lot of the same reasons I keep reaching for them. If I recall correctly, Microsoft introduced PowerShell classes mostly with DSC in mind, which I guess explains some of the weird feature gaps. Dot net core make both of those easier - the newish HTTPClient interface is much easier for .net and HTTP REPL is in many cases easier than invoke-restmethod although YMMV etc
|
# ? Jan 29, 2020 02:35 |
|
Microfuckingsoft posted:"For computer's [sic!] without any version of PowerShellGet installed, a computer with PowerShellGet installed is needed to download the [PowerShellGet] modules"
|
# ? Feb 3, 2020 17:27 |
|
While lovely, isn't it only really an issue for ancient versions of powershell?
|
# ? Feb 3, 2020 17:44 |
|
Anyone competent would just have a discoverable package index you could download a package from. I was looking into providing Powershell modules for airgapped systems. Setting up a controlled Debian mirror is trivial, but this is just typical Microsoftian bullshit. There's decades worth of accumulated knowledge around package management and MS is ignoring all of it.
|
# ? Feb 3, 2020 20:26 |
|
Antigravitas posted:Anyone competent would just have a discoverable package index you could download a package from. I was looking into providing Powershell modules for airgapped systems. Setting up a controlled Debian mirror is trivial, but this is just typical Microsoftian bullshit. Save-Module or Save-Package works on non-airgapped systems to download something. Beyond that you can setup your own repo with something a simple as a fileshare or as complicated with nuGet as you want to get.
|
# ? Feb 3, 2020 21:19 |
|
Since it looks like it's only an issue for PowerShell 4 and older, I wouldn't be shocked if the hassle were intended as a nudge to update WMF/PowerShell.
|
# ? Feb 3, 2020 21:25 |
|
Antigravitas posted:Anyone competent would just have a discoverable package index you could download a package from. I was looking into providing Powershell modules for airgapped systems. Setting up a controlled Debian mirror is trivial, but this is just typical Microsoftian bullshit. look up BaGet - it can even run in a Docker container
|
# ? Feb 5, 2020 07:16 |
|
It is kind of shocking how much it sucks managing PowerShell modules, and especially how instead of one big obvious sucky part, it feels like death by a thousand cuts where every little bit sucks just a little bit.
|
# ? Feb 5, 2020 07:24 |
|
I'm back again with a dumb question I can't properly articulate into Google. I'm trying to generate a list of all of our groups in O365 along with their owner(s). That's easy enough: code:
The output is Full Name Full Name, so I guess it might just be easier to convert the CSV into a proper Excel file and just do the string manipulation there.
|
# ? Feb 10, 2020 22:19 |
|
|
# ? May 15, 2024 23:26 |
|
Maybe a calculated property? E: https://4sysops.com/archives/add-a-calculated-property-with-select-object-in-powershell/ Phone posting, but maybe I’ll write up an example when I get back to my desk.
|
# ? Feb 10, 2020 22:29 |