Forum Widgets
Latest Discussions
change the primary address (prefix) distribution list group
change the prefix on the primary address distribution list group how to bulk change primary smtp address distribution list group (before @ / prefix) with powershell? can use csv file? if possible, what is the csv format and how is the script? please help, thank you.SolvedIrvanRNov 08, 2024Copper Contributor208Views0likes4CommentsRemove characters from a file name
Hi everyone I have a bunch of CSV files in a folder that need to be cleaned up. Both the file name and file contents have unneeded apostrophes. I need the apostrophes removed from the file name only. Leave contents untouched. For example, c/test/samp'le.csv becomes c/test/sample.csv. c:/test/Ol' Home.csv becomes c:/test/Ol Home.csv The script needs to look at each file in a given folder and remove the apostrophe if it finds one. Not every filename will have an apostrophe in it. The apostrophe can be anywhere in the name (beginning, end, middle of filename). How would I do this in Powershell? Thank youmanny213Nov 08, 2024Copper Contributor11Views0likes1CommentM365 Exchange & Shared Mailbox Calendar Notifications
M365 Business Premium tenant here. We have a shared mailbox (not resource mailbox) called meetings@ The aim is to have an anonymous email address staff can send out meeting requests to our clients and have a dedicated calandar for those meetings. I've set up the staff members with Receive and SendAs permissions so everyone can set up meetings using that account so that the meeting invite appears to come from meetings@ instead of the staff members email address. Staff can create meetings and the invite is anonymous so that part is working as planned. The problem is, all the staff gets flooded with Accept/Decline messages going to their personal mailboxes. Is there a way to set it so that only the shared mailbox gets the notifications or even supress those messages entirely. I've resorted to email rules for each staff member to either block or divert the messages but I'd really prefer it if there was a one stop shop rahter than having to configure individual's mailboxes to block them. I tried Set-CalendarProcessing -Identity "email address removed for privacy reasons" -RemoveForwardedMeetingNotifications $true -AutomateProcessing AutoUpdate but it didn't seem to do much. Any other ideas?DaleosNov 07, 2024Copper Contributor8Views0likes0CommentsPowerShell script to reinstall Windows license key
Greetings, I am new to PowerShell. I was talking with my boss recently about an issue we had following the Windows 11 24H2 update. The Windows license is being deactivated following the update. My boss has written a PowerShell script to resolve this issue but he asked me to see if I can write a script as well to fix the issue. He thought it would be good practice for me to learn PowerShell. So he has tossed me into the deep end and I need to quickly learn to swim; ) I need a script that would reinstall the Windows license key, activate the key, and change the DEP policy to opt out mode. This task is above my skill level and I could use some help. Thanks in advancejimmacd955iNov 07, 2024Copper Contributor6Views0likes0CommentsWindows Restricted User Experience Set-CimInstance Error
So I'm trying to set up a restricted user experience that allows the usage of only one application. However, I keep running into this weird error message that provides no useful information: I've been successful in getting the boilerplate example fromthe official Windows guide to work, so I'm fairly certain the error lies in how I've set up the Allowed Apps and PinnedList. Perhaps in the path to the app? But I'm not sure how I'd go about changing that since I got the pathway from the task manager. Any help is appreciated! Full code below: psexec.exe -i -s powershell.exe $assignedAccessConfiguration = @" <?xml version="1.0" encoding="utf-8"?> <AssignedAccessConfiguration xmlns="http://schemas.microsoft.com/AssignedAccess/2017/config" xmlns:rs5="http://schemas.microsoft.com/AssignedAccess/201810/config" xmlns:v3="http://schemas.microsoft.com/AssignedAccess/2020/config" xmlns:v5="http://schemas.microsoft.com/AssignedAccess/2022/config"> <Profiles> <Profile Id="{9A2A490F-10F6-4764-974A-43B19E722C24}"> <AllAppsList> <AllowedApps> <App AppUserModelId="Microsoft.RemoteDesktop_10.2.3012.0_x64__8wekyb3d8bbwe" /> </AllowedApps> </AllAppsList> <v5:StartPins><![CDATA[{ "pinnedList":[ {"packagedAppId":"Microsoft.RemoteDesktop_10.2.3012.0_x64__8wekyb3d8bbwe"}, ] }]]></v5:StartPins> <Taskbar ShowTaskbar="true" /> </Profile> </Profiles> <Configs> <Config> <AutoLogonAccount rs5:DisplayName="RDUSER" /> <DefaultProfile Id="{9A2A490F-10F6-4764-974A-43B19E722C24}" /> </Config> </Configs> </AssignedAccessConfiguration> "@ $namespaceName="root\cimv2\mdm\dmmap" $className="MDM_AssignedAccess" $obj = Get-CimInstance -Namespace $namespaceName -ClassName $className $obj.Configuration = [System.Net.WebUtility]::HtmlEncode($assignedAccessConfiguration) Set-CimInstance -CimInstance $obj11Views0likes1CommentUserProfile Management with PowerShell
We have an issue where quarterly Nessus scans enumerate vulnerability findings for every user profile on an endpoint. This started me on a path to remove obsolete user profiles to reduce the noise from Nessus. I need to accomplish three things in my final script: 1. set the execution policy to bypass; 2. reset the NTUser.dat to the last write time (if this is not done, the third criteria will not return any hits); 3. find all user profiles older than 60 days and delete them. I did try the GPO to delete profiles older than a certain number of days, but it never removes all of them. I pieced together a script from a couple diff sources and came up with the below. My PowerShell-fu is not that advanced so I am looking for suggestions to make it more efficient. The script works, but I noticed that empty user profile folders at C:\Users\ were left behind. Please advise. Is this a candidate to be made into a function? $ErrorActionPreference = "SilentlyContinue" $Report = $Null $Path = "C:\Users" $UserFolders = $Path | GCI -Directory $currentDate = Get-Date $ageLimit = 60 $userProfiles = Get-ChildItem -Path $Path Set-ExecutionPolicy Bypass -Force ForEach ($UserFolder in $UserFolders) { $UserName = $UserFolder.Name If (Test-Path "$Path\$UserName\NTUSer.dat") { $Dat = Get-Item "$Path\$UserName\NTUSer.dat" -force $DatTime = $Dat.LastWriteTime If ($UserFolder.Name -ne "default") { $Dat.LastWriteTime = $UserFolder.LastWriteTime } } } ForEach ($profile in $userProfiles) { $lastWriteTime = $profile.LastWriteTime $profileAge = ($currentDate - $lastWriteTime).Days If ($profileAge -ge $ageLimit) { Remove-Item -Path $profile.FullName -Recurse -Force } }ryedogg72Nov 06, 2024Copper Contributor7Views0likes0CommentsHow do I disable attachments in Outlook draft messages for my organization via Powershell?
My company wants to create a policy that prevents people from starting an Outlook message, adding an attachment to that message, going to another computer or device, opening Outlook on that device, and downloading the file from their draft message. we have O365 and Exchange Online. All the information I've found on setting Outlook options or draft options or any of that has been for individual users rather than organizations. I've been told that it can be done via powershell and office group policies, but TBH, I don't have much Powershell familiarity. Any suggestions?JMcGearyNov 04, 2024Copper Contributor118Views0likes6CommentsPowershell GPO
Need a gpo script to find the value of multiple policy settings For example Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment Need to get the value of both policy in a single PS scriptbala08yuvarajNov 04, 2024Copper Contributor133Views0likes1CommentHow do I permanently store module?
Hi everyone, I'm new to powershell, I would like to know how to automatically load the modules I load with import-module in each instance; if I load the modules with import-module, when I close the instance I lose the module. I would like to know how to permanently load, for example, the KPI module in the $Env:PsModulePath variable. Obviously the question is answered to all the modules that I always want to keep in section even when I start the computer. I hope for an answerSolvedmarika-9-5Nov 03, 2024Copper Contributor116Views0likes4CommentsHow do I get HP Bloatware script to run during enrollment?
Hi all I am wanting to put a script within Intune so during the deployment phase of autopilot it would remove the HP Bloatware however if I attach this script https://gist.github.com/mark05e/a79221b4245962a477a49eb281d97388into the deployment policy it would fail everytime. I can only remove it by going to the start menu , run powershell as admin and then run the script manually from there. What do I need to add so the script can run automatically? It wouldn't matter if it can't be run during the enrollment stage but I do want to somehow automatic this . ThanksRob_LamNov 03, 2024Brass Contributor296Views0likes2Comments
Resources
Tags
- Windows PowerShell1,114 Topics
- PowerShell333 Topics
- office 365266 Topics
- Azure Active Directory134 Topics
- SharePoint124 Topics
- Windows Server123 Topics
- windows94 Topics
- azure91 Topics
- exchange83 Topics
- Community53 Topics