Help with PowerShell to update licenses in O365

I’m trying to update / remove specific licenses from our office365 accounts From a specific text file with the email addresses Get-Content “<FileNameAndPath>” | ForEach { Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses “<AccountSkuId1>”, “<AccountSkuId2>”… Using the info from Microsoft but it fails and I’m stuck. Any help or guidance would highly help submitted by /u/kermit916 [link] [comments]

First script and other users have issue running it

I have the created the following script and I’m having issues. one there has to a way to make all this easier. Another user runs it and gets At line:1 char:8 $event Get-WinEvent -FilterHashtable @{logname=”Microsoft-Windows-Off … ~~~~~~~~~~~~ Unexpected token ‘Get-WinEvent’ in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnexpectedToken […]

Hashtable order

I have a script that pulls data from my Exchange environment and stores it in a custom hashtable I have created. The data is being placed into the hashtable from two separate arrays, so I am feeding the data into the hashtable manually. I need to make sure the hashtable’s values are matched with the […]

Issues with Import-Module on Custom PowerShell Core module with classes

Hello Everyone, ​ I have this sample custom powershell core module with a test class called TestModule and I’m unable to import the module: https://github.com/MSAdministrator/TestModule ​ When Running PowerShell Core 6.1.1 on macOS I receive the following error when attempting to Import the module: The specified module ‘/TestModule/Class/TestClass.psm1’ was not loaded because no valid module […]

How do I remove text from a string?

I have a list of strings of the following type: String –> “Usr123_Pst232-Time.Log” String –> “Usr143_Pst745-Time.Log” But I want it to become the following, that is I want to remove everything before the second hypen and everything after the dot String –> “Time” I came with the following code to replace everything before “Time”, but […]