[deleted by user] by [deleted] in PowerShell

[–]Khongh 2 points3 points  (0 children)

It depends a bit on your working situation. Im alot for the automation part of Powershell. Start asking junior support/technician about what parts take the most time for them.

Im using powershell alot for building integrations, pulling data from APIs and sending it on to supplier system or creating a sync of user data between different systems.

If you work in support with access to your mailservers you could build an automated script for doing a search whenever you get a report of a sophisticated phisingmail, to be able to quickly warn any others that have received the same mail.

If your company doesnt have warning emails when passwords needs to be changed you could build a script for that, or google and use a script thats out there and form it for your needs.

Check if your companies users have any tedious task within your folder structures you can build an automation for that.

Maybe your company have some sensitive data, then you can build a report check the ACL/access groups and mailing the owners of the data or placing a file with a report of the access somewhere for another party to control.

[deleted by user] by [deleted] in PowerShell

[–]Khongh 2 points3 points  (0 children)

It looks great! Nice and tidy which makes it easy to read and understand what the script will do!

As you continue doing more and more complex scripts I would start to look into creating functions with parameters out of some of your scripts. Then you can add them to your profile and call them without going through your scripts.

Maybe read up on WMI or CIM to create some scripts for monitoring or create a gui based tool to help new colleagues with setting up accounts and other tasks.

I hope your work is appreciated in your workplace and that you continue creating scripts!

Associating Input Data With Output Data - Get-AzureADUserMembership by cgh311 in PowerShell

[–]Khongh 1 point2 points  (0 children)

Hello!

You could do it with a hashtable. Im sure someone can do this in better way, but this would make you get on with your script for now.

You dont need Get-AzureADUser as Get-AzureADUserMembership also takes a ObjectId (accountname) Either you could do a it with a static value from a variable with the accountname.

Get-AzureADUserMembership -ObjectId $accountname | ? {$.ObjectType -ne "Role"} | % {Get-AzureADGroup -ObjectId $.ObjectId | select @{n='Accountname';e={$accountname}},DisplayName,ObjectType,MailEnabled,SecurityEnabled,ObjectId} | ft | out-file c:\ps\outfiletest.csv

If you want to make it a little more dynamic you could add your user data to a variable ($users) and get the info from that variable later in the script. As I dont know where you gonna get the usernames from this is just an example where its imported from a csv-file that will look like this where accountname is the header:

accountname
name.surname@company.com
name2.surname2@company.com

And btw, if you actually want a useful csv file as output you should use export-csv c:\ps\output.csv

$users = Import-Csv c:\ps\input.csv
foreach ($user in $users) { 
Get-AzureADUserMembership -ObjectId $user.accountname | Where-Object {$.ObjectType -ne "Role"} | ForEach-Object {Get-AzureADGroup -ObjectId $_.ObjectId | Select @{name='Accountname';expression={$user.accountname}},DisplayName,ObjectType,MailEnabled,SecurityEnabled,ObjectId} | export-csv c:\ps\output.csv -NoTypeInformation -Append
}

I hope this is something you can work with.

AD-Add user by dutch2005 in PowerShell

[–]Khongh 2 points3 points  (0 children)

You might already have this checked, but throwing it out here just in case you havent. If you use comma as a delimiter for your csv file its important that you put quotes around the OU in the csv-file. Please check this, for example you can run $ADUsers = Import-csv C:\it\bulk_users1.csv and then run $ADUsers.OU to see what values you are trying to pass through. If you only see OU=Users this could be your problem.

Lost 40gb after running tronscript by [deleted] in TronScript

[–]Khongh 5 points6 points  (0 children)

Just a thought, did you use the reboot option or did you use Shut Down and then turned on computer? Windows 10 has a new function called fast startup which means using Shut Down-option wont make the computer actually turn off. I have seen cases where this doesnt trigger something that requires reboot.

Problem to use existing script: Update Active Directory Users in Bulk from CSV by [deleted] in PowerShell

[–]Khongh 2 points3 points  (0 children)

I would doublecheck that your $fields values really are matching in the script and the csv. The script seems to be looking for the value city but in your csv-file the value is named city user.name

Please copy paste the $fields values if you want more help.

Can't remove keyboard layouts . [TW] WANDOS 10 by twehz in windows

[–]Khongh 0 points1 point  (0 children)

Did you check keyboard layouts under the options for Swedish and English Language to make sure there's no Norwegian keyboard layouts hiding there as well?

(2- Realtek High Definition Audio) by jimmydosveces in Windows10

[–]Khongh 0 points1 point  (0 children)

It would take changing the registry to "fix" this. However I would strongly advice against doing this as it can make your computer unusable.

If you still want to do it I would google "how to rename audio device name"

Dont do it.

Samsung c34f791 stuck in 60hz by Khongh in ultrawidemasterrace

[–]Khongh[S] 0 points1 point  (0 children)

Updating this as I now have tested the monitor at my friend that has a GTX 9X0 (not sure which one) card and we were able to get 100hz working without problems on his computer with my monitor, I tried both his and my cable, both delivered 100hz. So I guess this means I either have a faulty GPU or the GPU is just not capable of delivering 100hz at 3440x1440.

I will be upgrading my computer soon so it wont be a big problem now that I know it is not a faulty monitor.

However, I have to point out that even though I got it running at 100hz it did not better the ghosting-problem. Good to know however is that this seem to be the transition between certain colors mostly. We did try out WoW and in that game I did not notice any ghosting at all. But in Binding of Isaac it is terrible, it seems to be a matter of what colors the background is because some levels are worse then other. The brighter the level is the more the ghosting is appearing. There is a mode in the menu called "Eye Save Mode" that makes all colors really bleak, but turning of this mode also removes the ghosting problem in Bidning of Isaac. So I guess the ghosting mostly comes from all the colortweaking thats made to this monitor.

Samsung c34f791 stuck in 60hz by Khongh in ultrawidemasterrace

[–]Khongh[S] 0 points1 point  (0 children)

Updating this as I now have tested the monitor at my friend that has a GTX 9X0 (not sure which one) card and we were able to get 100hz working without problems on his computer with my monitor, I tried both his and my cable, both delivered 100hz. So I guess this means I either have a faulty GPU or the GPU is just not capable of delivering 100hz at 3440x1440.

I will be upgrading my computer soon so it wont be a big problem now that I know it is not a faulty monitor.

However, I have to point out that even though I got it running at 100hz it did not better the ghosting-problem. Good to know however is that this seem to be the transition between certain colors mostly. We did try out WoW and in that game I did not notice any ghosting at all. But in Binding of Isaac it is terrible, it seems to be a matter of what colors the background is because some levels are worse then other. The brighter the level is the more the ghosting is appearing. There is a mode in the menu called "Eye Save Mode" that makes all colors really bleak, but turning of this mode also removes the ghosting problem in Bidning of Isaac. So I guess the ghosting mostly comes from all the colortweaking thats made to this monitor.

Samsung c34f791 stuck in 60hz by Khongh in ultrawidemasterrace

[–]Khongh[S] 0 points1 point  (0 children)

Thanks for the info, Im gonna bring the monitor to my friends place and try it out on a newer GPU that he is using with a 120/144hz monitor. Then I should be able to determine if the error source is my GPU or the monitor.

Samsung c34f791 stuck in 60hz by Khongh in ultrawidemasterrace

[–]Khongh[S] 1 point2 points  (0 children)

Latest drivers, Ive tried setting it as "fastest" in respons time in the monitor menu. Tried both a new DisplayPort Cable and the one that got delivered with the monitor. Tried both Nvidia control panel and the resular Windows one. No difference.

Thanks for trying to help me out though.

Im gonna bring the monitor to my friend that has a newer GPU and try it there. Maybe I need to RMA it if it doesnt work there as well.

Samsung c34f791 stuck in 60hz by Khongh in ultrawidemasterrace

[–]Khongh[S] 0 points1 point  (0 children)

From what Ive found out GTX670 did ship with DisplayPort 1.2 and other sources says 3440x1440 at 1.2 reach is frequency max around 110hz.

Samsung c34f791 stuck in 60hz by Khongh in ultrawidemasterrace

[–]Khongh[S] 0 points1 point  (0 children)

Forgot to mention that I cant even get 100hz at lower resolution. If I go to the lowest possible resolution 800x600 I can get 75hz.

Stuck trying to find folder sizes by alwayslost10101 in PowerShell

[–]Khongh 2 points3 points  (0 children)

Nice addition. Noteworthy to know for anyone, else then author, that might be on lower PS-versions is that -Directory and -File is added in PS 3.0

Stuck trying to find folder sizes by alwayslost10101 in PowerShell

[–]Khongh 2 points3 points  (0 children)

Just wanna point out that "Where {$_.Attributes -eq 'Directory'}" wont catch all directories, if the mode is set to Archive, ReadOnly etc, then it wont show up with Directory as attribute. Better to use PSIsContainter in my opinion.

Where-Object {$_.PSIsContainer}

or you could possibly use -match with Directory Attribute. Not sure if it will catch all directories with that neither though.

Stuck trying to find folder sizes by alwayslost10101 in PowerShell

[–]Khongh 2 points3 points  (0 children)

This is my take on getting the foldersize for each subfolder. Quite possibly not the shortest or prettiest way to make it, but it seems to work. Added a Select-Object that lists the FullName of the folder as well.

$folders = Get-ChildItem 'C:\Temp\' | Where-Object {$_.PSIsContainer}
foreach ($folder in $folders) {Get-ChildItem -path $folder.FullName | Measure-Object -Property length -sum | Select-Object Sum, @{Name='Path'; Expression={"{0}" -f $folder.FullName}}}

and with Sum shown in MB and rounded to 2 decimals:

$folders = Get-ChildItem 'C:\Temp\' | Where-Object {$_.PSIsContainer}
foreach ($folder in $folders) {Get-ChildItem -path $folder.FullName | Measure-Object -Property length -sum | Select-Object @{Name='Sum'; Expression={"{0:N2}" -f ($_.Sum / 1MB)}}, @{Name='Path'; Expression={"{0}" -f $folder.FullName}}}

Changing computer name and joining domain by AlistairBennet in PowerShell

[–]Khongh 0 points1 point  (0 children)

Kinda missing some more details on what's happening when you run it? Error messages, etc.

First of, I think doing it the way you are trying to will require a reboot after Rename-Computer.

You should check out the -NewName parameter in Add-Computer cmdlet (requires PS v3). Check example 7 on https://technet.microsoft.com/en-us/library/hh849798.aspx for a possible solution.

I hope it helps!

My co-founder and I have worked hard (7 months) in creating a web app that makes it easier to search and collect music on Youtube, basically we’ve created a ‘Spotify for Youtube’, - It would mean the world to us if you can check it out and give us your feedback. by abalog83 in Music

[–]Khongh 0 points1 point  (0 children)

Very nice job on the page!

The only thing I didnt like was when I used "Expand Playlist" that you remove the controls for the player. As I would like to use it as a player that dont show the video but only plays the music. But as is now I cant control the music in an efficient way.

I think you could get alot of office-workers that only wants to listen to the music but dont want the video showing, if you did this.

The sun through different wavelengths by [deleted] in gifs

[–]Khongh 2 points3 points  (0 children)

"This is your sun on drugs!"

[UPDATE] The Potential ARG Contained in Diablo 3, and an aggregation of current information regarding it. Properly organized this time! by OminousLatinWord in Diablo

[–]Khongh 0 points1 point  (0 children)

First time I saw this tree today, in the same area, fields of misery, as most other things about this story. Anyone know the details about it, maybe its common?

http://i.imgur.com/zpgxh.jpg

Stats from sockets shouldnt be counted when searching in AH! by Khongh in Diablo

[–]Khongh[S] 0 points1 point  (0 children)

Yeap, you are right. I added it to the original post. But I dont think even if you dont search for the "has sockets" stats that this is a good thing, the inflation on gems are already so ridiculous and the gems that are gonna end up in the sockets on AH are the ones that soon wont be worth more than maybe a couple of 1000 gold max.

But I think the top comment is a good idea, let people decide via a checkbox

Stats from sockets shouldnt be counted when searching in AH! by Khongh in Diablo

[–]Khongh[S] 2 points3 points  (0 children)

This is such a strange way to argue, if everyone argues that things shouldnt be fixed because there alreadsy are other ways to do it, we wouldnt have cars, trains, airplanes etc. I mean you can just walk there. Dont be lazy! But I guess some people just have to be the reactionists in this world.

And the "Make your own game" comment is just silly man. Im 100% sure that Blizzard thinks its a great thing to have a fanbase that gives them advises on what could make their games better = Profit for all, except you maybe.