-
Posts
452 -
Joined
-
Last visited
Content Type
Forums
News
20th
EduGeek EDIT Conference
Blogs
Everything posted by tri_94
-
Hi just wondering if you had an idea for a method i could use? Thanks Nick
-
It was really just to read to check membership, I intended to grid view for most of the time but with a passthur to be able to select users and export to csv occasionally Thanks
-
Hi, Thanks for that. I guess that makes sense, I find it just strange that the variable has the data in but just doesn't display it. Can you recommend a different way of doing it? Thanks
-
Hi there I've got a small problem with my script below. It used to lookup ad users from firstname and surname along with a username prefix and returns the UPN and group membership It does what it works fine for a single user, however if used for multiple and they have a different amount of groups it only shows some. in Grid-view or export-csv, however if I call the variable $obj it has all the groups in Thanks $results = @() $site = "U1" #User prefix foreach ($a in $b) { $item = New-Object PSObject $item | Add-Member -type NoteProperty -Name 'GivenName' -Value $a.Split("+")[0] $item | Add-Member -type NoteProperty -Name 'Surname' -Value $a.Split("+")[1] $results += $item } $Output = @() foreach ($user in $results) { $firstname = $user.GivenName $lastname = $user.Surname $aduser = Get-ADUser -Filter 'GivenName -eq $firstname -and sn -eq $lastname' -properties EmailAddress | where { $_.samaccountname -match $Site} | select GivenName, Surname, UserPrincipalName, EmailAddress $id = $aduser.UserPrincipalName.split("@")[0] $user = get-aduser $id -properties samaccountname,givenname,surname $groups = Get-ADPrincipalGroupMembership $id | select -expand name $obj = New-Object PSObject $obj | Add-Member -type NoteProperty -Name 'Username' -Value $user.samaccountname $obj | Add-Member -type NoteProperty -Name 'Firstname' -Value $user.givenname $obj | Add-Member -type NoteProperty -Name 'Surname' -Value $user.surname $int = 0 Foreach ($e in $groups) { if ($int -eq $groups.Count) {break} $obj | Add-Member -type NoteProperty -Name Group$int -Value $e $int ++ } #} $Output += $obj } $export = $Output | Sort-Object UserPrincipalName $export | Out-GridView -PassThru | export-csv "d:\test\exuser.csv" -NoTypeInformation
-
I'll have a good look at this when I have the time, but thanks to everyone for you help. - - - Updated - - - That's brill I'll rework the script Thanks again.
-
Hi there We are new to teams this year and wondered what process people normally do and how you go about it. We are thinking along the lines of Changing the team and email name (added a year prefix maybe) Then archiving the teams and remove all membership. That way we have the name and email ready to be used again. Thanks
-
Attached is a copy of the script Its too long to upload in the normal fashion. Code.ps1 Thanks
-
Test.xml Attached is a sample xml Thanks
-
I've got a method that is working. I'm sure not the best way, using .SQLInstance[0] and then using this foreach loop foreach($Scan in $Scanned) { $Object = New-Object PSObject $Object | add-member Noteproperty $Scanned[0] $Scannedad[0] $Object | add-member Noteproperty $Scanned[1] $Scannedad[1] $Object | add-member Noteproperty $Scanned[2] $Scannedad[2] $Object | add-member Noteproperty $Scanned[3] $Scannedad[3] $Object | add-member Noteproperty $Scanned[4] $Scannedad[4] $Object | add-member Noteproperty $Scanned[5] $Scannedad[5] $Object | add-member Noteproperty $Scanned[6] $Scannedad[6] $Object | add-member Noteproperty $Scanned[7] $Scannedad[7] $Object | add-member Noteproperty $Scanned[8] $Scannedad[8] $Object | add-member Noteproperty $Scanned[9] $Scannedad[9] $Object | add-member Noteproperty $Scanned[10] $Scannedad[10] $Object | add-member Noteproperty $Scanned[11] $Scannedad[11] and writing the data to excel and then changing SQLInstance[1] and next loop Thanks
-
yes that's basically it
-
Hi there The idea is that i want to extract the data held within "Check" and output it to excel for each "Name", as in MSAS13.MSSQLSERVER, MSRS13.MSSQLSERVER Does that make sense? Thanks
-
Hi there I'm trying to collate some data and have the following information being pulled in from xml Name Check ---- ----- (default) {Domain Controller Test, SQL Server/MSDE Security Mode, CmdExec role, Registry Permissions...} MSAS13.MSSQLSERVER {Domain Controller Test, SQL Server/MSDE Security Mode, CmdExec role, Registry Permissions...} MSRS13.MSSQLSERVER {Domain Controller Test, SQL Server/MSDE Security Mode, CmdExec role, Registry Permissions...} MSSQL13.MSSQLSERVER {Domain Controller Test, SQL Server/MSDE Security Mode, CmdExec role, Registry Permissions...} (default) (32-bit) {Domain Controller Test, SQL Server/MSDE Security Mode, CmdExec role, Registry Permissions...} What I was thinking is to create a new ps object for each name and the throw the data in to a new object however I cant seem to get it to create new object in a foreach loop or am i going about this in totally the wrong way? Thanks
-
Hi there I've created reports from MBSA, and converted them to xml files. I would like to collect all the data and create an excel spreadsheet I can do this for some and have ran into a problem that not all the reports are the same think I've got a way around that part now but also I can't seem to get all the information from the reports. Below is my PowerShell code and example xml which I can't seem to pull data from fields: CmdExec role Domain Controller Test Folder Permissions Guest Account Password Policy Registry Permissions Service Accounts SQL Server/MSDE Security Mode SSIS Roles Sysadmin role members Sysadmins Sysdtslog also some of these fields are repeated so how's the best way to catch all of that data? Thanks $Excel = New-Object -comobject Excel.Application $Excel.visible = $True $Workbook = $Excel.Workbooks.Add() $Info = $Workbook.Worksheets.Item(1) # Create our column headers $Info.Cells.Item(1,1) = "Server name" $Info.Cells.Item(1,2) = "Local Account Password Test" $Info.Cells.Item(1,3) = "Security Updates" $Info.Cells.Item(1,4) = "Windows Version" $Info.Cells.Item(1,5) = "File System" $Info.Cells.Item(1,6) = "Password Expiration" $Info.Cells.Item(1,7) = "Guest Account" $Info.Cells.Item(1,8) = "Autologon" $Info.Cells.Item(1,9) = "Restrict Anonymous" $Info.Cells.Item(1,10) = "IE Zones" $Info.Cells.Item(1,11) = "IE Enhanced Security Configuration for Administrators" $Info.Cells.Item(1,12) = "IE Enhanced Security Configuration for Non-Administrators" $Info.Cells.Item(1,13) = "Auditing" $Info.Cells.Item(1,14) = "Shares" $Info.Cells.Item(1,15) = "Administrators" $Info.Cells.Item(1,16) = "Macro Security" $Info.Cells.Item(1,17) = "Services" $Info.Cells.Item(1,18) = "Windows Firewall" $Info.Cells.Item(1,19) = "Automatic Updates" $Info.Cells.Item(1,20) = "Incomplete Updates" $Info.Cells.Item(1,21) = "SQL Server/MSDE Status" $Info.Cells.Item(1,22) = "IIS Status" # Add a little formatting $Style = $Info.UsedRange $Style.Interior.ColorIndex = 19 $Style.Font.ColorIndex = 11 $Style.Font.Bold = $True $Style.Columns.AutoFit() $intRow = 2 # grab our XML files $files = Get-ChildItem -path "D:\Test\Servers" cd "D:\test\Servers" #iterate over each .mbsa file foreach ($file in $files) { [xml]$ScanResult = Get-Content $file $Scanned = $ScanResult.SecScan.Check | select Name, Advice $Server = $ScanResult.SecScan.Machine foreach($Scan in $Scanned) { $Object = New-Object PSObject $Object | add-member Noteproperty $Scanned.name[0] $Scanned.advice[0] $Object | add-member Noteproperty $Scanned.name[1] $Scanned.advice[1] $Object | add-member Noteproperty $Scanned.name[2] $Scanned.advice[2] $Object | add-member Noteproperty $Scanned.name[3] $Scanned.advice[3] $Object | add-member Noteproperty $Scanned.name[4] $Scanned.advice[4] $Object | add-member Noteproperty $Scanned.name[5] $Scanned.advice[5] $Object | add-member Noteproperty $Scanned.name[6] $Scanned.advice[6] $Object | add-member Noteproperty $Scanned.name[7] $Scanned.advice[7] $Object | add-member Noteproperty $Scanned.name[8] $Scanned.advice[8] $Object | add-member Noteproperty $Scanned.name[9] $Scanned.advice[9] $Object | add-member Noteproperty $Scanned.name[10] $Scanned.advice[10] $Object | add-member Noteproperty $Scanned.name[11] $Scanned.advice[11] $Object | add-member Noteproperty $Scanned.name[12] $Scanned.advice[12] $Object | add-member Noteproperty $Scanned.name[13] $Scanned.advice[13] $Object | add-member Noteproperty $Scanned.name[14] $Scanned.advice[14] $Object | add-member Noteproperty $Scanned.name[15] $Scanned.advice[15] $Object | add-member Noteproperty $Scanned.name[16] $Scanned.advice[16] $Object | add-member Noteproperty $Scanned.name[17] $Scanned.advice[17] $Object | add-member Noteproperty $Scanned.name[18] $Scanned.advice[18] $Object | add-member Noteproperty $Scanned.name[19] $Scanned.advice[19] $Object | add-member Noteproperty $Scanned.name[20] $Scanned.advice[20] $Object | add-member Noteproperty $Scanned.name[21] $Scanned.advice[21] $Style.Cells.Item($intRow, 1) = $Server switch ($Scan.Name) { "Local Account Password Test" {$Style.Cells.Item($intRow, 2) = $Object.'Local Account Password Test';break} "Security Updates" {$Style.Cells.Item($intRow, 3) = $Object.'Security Updates';break} "Windows Version" {$Style.Cells.Item($intRow, 4) = $Object.'Windows Version';break} "File System" {$Style.Cells.Item($intRow, 5) = $Object.'File System';break} "Password Expiration" {$Style.Cells.Item($intRow, 6) = $Object.'Password Expiration';break} "Guest Account" {$Style.Cells.Item($intRow, 7) = $Object.'Guest Account';break} "Autologon" {$Style.Cells.Item($intRow, 8) = $Object.Autologon;break} "Restrict Anonymous" {$Style.Cells.Item($intRow, 9) = $Object.'Restrict Anonymous';break} "IE Zones" {$Style.Cells.Item($intRow, 10) = $Object.'IE Zones';break} "IE Enhanced Security Configuration for Administrators" {$Style.Cells.Item($intRow, 11) = $Object.'IE Enhanced Security Configuration for Administrators';break} "IE Enhanced Security Configuration for Non-Administrators" {$Style.Cells.Item($intRow, 12) = $Object.'IE Enhanced Security Configuration for Non-Administrators';break} "Auditing" {$Style.Cells.Item($intRow, 13) = $Object.Auditing;break} "Shares" {$Style.Cells.Item($intRow, 14) = $Object.Shares;break} "Administrators" {$Style.Cells.Item($intRow, 15) = $Object.Administrators;break} "Macro Security" {$Style.Cells.Item($intRow, 16) = $Object.'Macro Security';break} "Services" {$Style.Cells.Item($intRow, 17) = $Object.Services;break} "Windows Firewall" {$Style.Cells.Item($intRow, 18) = $Object.'Windows Firewall';break} "Automatic Updates" {$Style.Cells.Item($intRow, 19) = $Object.'Automatic Updates';break} "Incomplete Updates" {$Style.Cells.Item($intRow, 20) = $Object.'Incomplete Updates';break} "SQL Server/MSDE Status" {$Style.Cells.Item($intRow, 21) = $Object.'SQL Server/MSDE Status';break} "IIS Status" {$Style.Cells.Item($intRow, 22) = $Object.'IIS Status';break} } Remove-Variable object } $intRow = $intRow + 1 } # And save it away: $Path = "D:\test\servers.xlsx" $Workbook.SaveAs($Path,51) $excel.Quit() [system.Runtime.Interopservices.Marshal]::ReleaseComObject($excel) Start-Sleep 1 'Excel processes: {0}' -f @(Get-Process excel -ea 0).Count invoke-item $path
-
Hi there We seem to be having issues with profile photos disappearing in Teams. The photo shows I'm Teams admin portal, Office 365 admin portal, Exchange online and some of the users their photo will show on the IOS teams app. But in the desktop app or web browser doesn't appear. (Yes I've cleared the cache and logged out and back in.) We normally upload via PowerShell to exchange online. The photo then seems to sync to Azure, Teams (At times it seems we have to wait longer then 24hrs) I've raised a ticket about this which was open for weeks and kept being told to re-upload in SharePoint. Which i did for test users and most times after 2-3 days the photos would display. The ticket got shut as most of the users that I re-uploaded the photos for were showing and fine. However checked this morning and users that i re-uploaded the photo weeks ago have now disappeared. Again they show in the admin portals and exchange online, just not in teams itself. Trying to understand the steps as how the photos sync works. I know that the Set-Userphoto places the photo into exchange mailbox. But this must also sync to Azure and Teams etc. I've looked at sites like https://support.microsoft.com/en-us/office/information-about-profile-picture-synchronization-in-microsoft-365-20594d76-d054-4af4-a660-401133e3d48a But it seems to say there isn't a sync to azure. Also Teams isn't mentioned The users that I've uploaded photo in SharePoint if I go to https://mydomain.sharepoint.com/_layouts/15/userphoto.aspx?size=S&[email protected] i can then download the photo. But others which the photo appears in Teams if I try and get their photo in the same way I just get a place holder. So I assume that its not on SharePoint. So if anyone has any ideas is how the sync works that would be great. Thanks
-
[sims] Script /Method to Uninstall SOLUS 3 Agent From Clients?
tri_94 replied to JRA's topic in MIS Systems
How many machines are you talking? Would not you be better off using group policy to reinstall and register them to Solus database? -
. It was just a case of being able to update certain software while users are logged in and having them not notice a new drive mapping appear etc. Thanks
-
Hi there I'm trying to create an software updater for remote computers. I would like to create a hidden mapping rather then copy the files to the computer, i though that i could use New-PSDrive inorder to do this but maybe i'm wrong. Thanks $computer = Read-Host "Enter Computer Name" #Start Windows Remote Service #Get-Service -Name WinRM -ComputerName $computer | Start-service #Run Updater on remote computer Invoke-Command -ComputerName $computer -ScriptBlock { New-PSDrive -Name "B" -PSProvider "FileSystem" -Root "\\Computer\Share\" Start-Process 'B:\Update.msi' } #Stop Windows Remote Service #Get-Service -Name WinRM -ComputerName $computer | Stop-service
-
Brill looks like that's working.. Many thanks
-
Thanks for that it looks better but i just get "Length 9135 " in the csv ouput and not what I hoped for Many Thanks
-
Hi there I'm trying to get information from AD, I would like to import a list of first name and surnames and get the UPN out. This is what i have so far but doesn't seem to work Thanks $group = Import-csv "D:\test\group1.csv" $Object = New-Object PSObject #Get-AdUser -Filter {givenName -eq 'joe' -and surname -eq 'bloggs'} ForEach($User in $group) { $firstname = $user.givenName $surname = $User.surname $data = Get-AdUser -Filter { givenName -eq $firstname -and surname -eq $surname} | Select-Object GivenName, Surname,UserPrincipalName $Object | add-member "Firstname" $data.GivenName $Object | add-member "Surname" $data.Surname $Object | add-member "UserPrinicpalName" $data.UserPrincipalName $firstname = "" $surname = "" }
-
Thank you for that @spadam . hadn't thought of using the type method.
-
Hi there I'm sure that someone else will have had this request. I'm looking for a way to block students access to control panel and settings however still leave access to ease of access center. I know with GPO I can hide items from control panel but if they have a shortcut it will still work. So I'm looking for another way to block it. Thanks
-
Thank you for that. It works as you suggested.
-
Hi there I've got a script to deploy Teams MSI, it currently compares the MSI version with the EXE version installed on the pc and if they don't match will uninstall and then reinstall the correct version. Just trying to tidy up the script really. problem i've got is the exe has both file version and product version. Get-item returns product version. $LocalVersion = (Get-Item "C:\Program Files (x86)\Teams Installer\Teams.exe").VersionInfo.FileVersion MSi version is 1.3.0.28779 but the exe version is 1.3.00.28779 currently I use the following code if ($LocalVersion -eq "1.3.00.28779") {$LocalVersion = "1.3.0.28779" I would like to be able to just change the msi and not have to add a new if statement for every version that comes out. Using Orca i've checked to see if the version with two 00's is in the msi properties and its not. So is there a way to tell ignore the second 0 in the version number? Hope this makes sense. Thanks
-
Hi there I've got a script to deploy Teams MSI, it currently compares the MSI version with the EXE version installed on the pc and if they don't match will uninstall and then reinstall the correct version. Just trying to tidy up the script really. problem i've got is the exe has both file version and product version. Get-item returns product version. $LocalVersion = (Get-Item "C:\Program Files (x86)\Teams Installer\Teams.exe").VersionInfo.FileVersion MSi version is 1.3.0.28779 but the exe version is 1.3.00.28779 currently I use the following code if ($LocalVersion -eq "1.3.00.28779") {$LocalVersion = "1.3.0.28779" I would like to be able to just change the msi and not have to add a new if statement for every version that comes out. Using Orca i've checked to see if the version with two 00's is in the msi properties and its not. So is there a way to tell ignore the second 0 in the version number? Hope this makes sense. Thanks
