Produce list of all security groups a group of users are members of
Reddit » PowerShell
by /u/PantherusNZ
3h ago
I'm trying to produce a list of all the AD Security Groups that a subset of users belong to as I need to use the data to produce team templates. We get the subset of users via "Get-ADUser -Filter" and then intend to pipe it through to "Get-ADPrincipalGroupMembership" but it just gives me a list of all the groups, not showing the link between users and groups - so not sure whether this is even possible as I'm doing it. Ideally the output I want is a CSV where each line starts with the user's name, and then a list of all their security groups - is this possible? Any help is appreciated, thank y ..read more
Visit website
Trying to copy a file that needs admin access to a fileshare
Reddit » PowerShell
by /u/CharacterWitless78
3h ago
I am trying to write a script run from a monitoring app that will remotely copy a log file from a location on a PC that only Admins and System can access to a network fileshare. The logic of the script works and I can access the file with system permissions but can't copy it to the share since the share doesn't know about system permissions. I tried to allow write access to the folder to 'Everyone' but still fails. I know it is a permissions issue but am trying to figure out what I can do to allow the file to be copied to a network share that can't authenticate the local system. submitted by ..read more
Visit website
Import-CSV not pulling through UserPrincipalNames
Reddit » PowerShell
by /u/Modern-Lumberjack
3h ago
Hi guys, hope all is well! Run into a bit of a brick wall with a PowerShell script I'm using. I want to import a Inbox-Rule to my users mailboxes which will move emails containing X to the deleted folder. It works instantly for my admin account but nothing for the others. I've exported the user CSV list and imported using what I think is correct. $csvfile = "C:\Users\*********\Downloads\users_4_25_2024 4_29_50 PM.csv" $Users = Import-Csv $csvfile New-InboxRule -Name "test4" -Mailbox $Users.userprincipalname -FromAddressContainsWords DomainNameHere -BodyContainsWords WordHere -DeleteMessage $t ..read more
Visit website
Script to read and control global mic mute in Windows
Reddit » PowerShell
by /u/DocHoss
3h ago
I'm wanting an easy way to get the status of the global mic monitor (not sure what it's actually called). I just got an Elgato Stream Deck and am wanting to run a quick Powershell script to mute or unmute, but also read the current status so it can be reflected in the deck icon. I'm talking about the mic control that is modified by Win + Alt + K...I can already fire a shortcut key that does that, but I'd ideally like to be able to read the state so it can display a microphone or mic with a slash through it. Is there a (somewhat) easy way to do that? I'm pretty solid with Powershell but if thi ..read more
Visit website
Powershell and Schedule Tasks
Reddit » PowerShell
by /u/dz1mm3rm4n
3h ago
I am having some trouble with a Powershell command running as a Scheduled Task. The command works fine when run manually but seems to do nothing when the task runs successfully. I am hoping someone can at least point me in the right direction. Command: $printer = Get-CimInstance -Class Win$printer = Get-CimInstance -Class Win32_Printer -Filter "Name='Microsoft Print to PDF'" && Invoke-CimMethod -InputObject $printer -MethodName SetDefaultPrinter Scheduled Task Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exen Arguments: -ExecutionPolicy Bypass -Command ${$prin ..read more
Visit website
User Off-boarding
Reddit » PowerShell
by /u/papapinguino800
3h ago
Looking to run something for some advice. Saw a post about a script for off boarding and it kicked me on a project idea. When someone leaves our org, we: change password, deactivate account, copy group memberships to a .txt file, move the user to a “termed” OU, and change the description to the date termed. We typically do all of this manually, and not that it takes that long, but I think I can get this all in one ps1 file. I currently have it written in a word doc and just do ctrl+H and replace $username with the Sam name of the user then copy and paste into powershell window and run. I want ..read more
Visit website
Azure Communication SMS Send
Reddit » PowerShell
by /u/Jddf08089
3h ago
I'm trying to send sms messages from an PowerShell Azure runbook with Azure communication services. The trouble is I don't really know what I'm doing. It works well from PowerAutomate but I can't figure out how to do it in PowerShell. Has anybody else done this? submitted by /u/Jddf08089 [visit reddit] [comments ..read more
Visit website
Powershell, but bash?
Reddit » PowerShell
by /u/blitz4
3h ago
has there been any projects that attempt to adding a way for those familiar with bash to use that knowledge in ps? if there's not such a project, is there a way to put grep into ps as it exists in bash by creating functions and aliases? ms provided the findstr command, but no matter what I do I can't do something like the below it doesn't work. ps just behaves differently and i wish i did, but would rather not learn a new shell when I'll never be more proficient in ps as bash. alias grep "findstr /i" echo Hi |grep hi submitted by /u/blitz4 [visit reddit] [comments ..read more
Visit website
I need a script that would check all users in azure ad & device they logged in/are using it based on their logins. WHat would be the best way to do this ?
Reddit » PowerShell
by /u/damir19081
3h ago
submitted by /u/damir19081 [visit reddit] [comments ..read more
Visit website
Invoke-Command for getting folder sizes producing different outputs when running locally
Reddit » PowerShell
by /u/MrSilverSoupFace
3h ago
I have noticed something weird with Invoke-Command cmdlet outputting different results than on local server when trying to get folder size values. Background Making an efficiency improvement which involves automatically deleting user accounts on servers whose SIDs do not resolve. This involves running the script on the DC. The script uses the: Get-CimInstance -ClassName Win32_UserProfile command. More specifically, the full command to get the User profiles that are not System/.NET related is: Get-CimInstance -ComputerName $server -ClassName win32userprofile -ErrorAction Stop | Where-Object ..read more
Visit website

Follow Reddit » PowerShell on FeedSpot

Continue with Google
Continue with Apple
OR