The post Export Exchange 2016, 2013, & 2010 Mailboxes Backup to PST using PowerShell Commands. appeared first on How to Code .NET.
Export Exchange 2016, 2013, & 2010 Mailboxes Backup to PST using PowerShell Commands.
Allow non admin (and another for admin) users to remotely see who is logged on to a remote PC?
I need to allow non admin users to run a script and see who remotely is logged on to a remote workstation.
They would just type the name of the workstation and it would say
“The user $domainuser is logged on”
or it would say
“Noone is currently logged on”
Another script would do the same thing PLUS kick said user (or users) off
I dont want to (and can’t) play with adding AD attributes or anything of that sort
Thanks
submitted by /u/riahc4
[link] [comments]
The post Allow non admin (and another for admin) users to remotely see who is logged on to a remote PC? appeared first on How to Code .NET.
OutTabulatorView
I saw /u/jsnover retweet this module of Doug Finke (same person who created the awesome ImportExcel module). I thought this would have already been shared here but it looks not.
Seem’s a pretty powerful module for creating dynamic tables that run in a browser (not IE mind…).
https://github.com/dfinke/OutTabulatorView
It’s on the PowerShell Gallery.
Install-Module -Name OutTabulatorView
submitted by /u/Swarfega
[link] [comments]
The post OutTabulatorView appeared first on How to Code .NET.
Updating AD Job Title using CSV
I hope that someone will be able to help me out with this!
I’m trying to update several hundred job titles using a CSV file that’s populated with email addresses and the new job titles.
This is what I’ve written in PowerShell so far but haven’t been able to make it work yet…
Import-Module ActiveDirectory $data = import-csv -path C:TempBook2.csv foreach ($user in $data){ Get-ADUser -Filter “Name -eq ‘$($user.mail)'” | Set-ADUser -Replace @{title = “$($user.role)”}}
Feel as though I’m nearly there so any help or assistance would be greatly appreciated!
submitted by /u/CuttsAndBruises
[link] [comments]
The post Updating AD Job Title using CSV appeared first on How to Code .NET.
Display list of installed software including product keys
Hey, complete newbie to PS here so very sorry if my explanation is poor.
I came across the following command –
Get-ItemProperty HKLM:SoftwareWow6432NodeMicrosoftWindowsCurrentVersionUninstall* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize >
Stolen from here.
I was wondering if it was possible to also include any applicable product keys, I’m particularly interested in getting the key for any office products installed on the machines in question.
I am currently using a bit of freeware from MSI Solutions that outputs this for me already, however I was hoping this could be completed through the use of a PS command without the need for relying on 3rd party software.
I’ve stumbled upon a number of links for functions that I have no idea how to integrate into what I already have. Could anyone give me a little nudge in the right direction / let me know if I’m going about it incorrectly?
submitted by /u/Bobby_FuckingB
[link] [comments]
The post Display list of installed software including product keys appeared first on How to Code .NET.
Finished New Starter
Hi All,
Thanks for all the help over the last week or so, just wanted to share my new starter script that you all helped me finish.
If there is anything i can improve happy for ideas
thanks
submitted by /u/pquinn1212
[link] [comments]
The post Finished New Starter appeared first on How to Code .NET.
Trying to create a PowerShell scheduled checklist.. checker
Hi there.
I’m trying to keep all of our user info synchronized between our different directories (AD, G suite, Office365, CW).
What I wanted to start off with was checking the AD to verify the user’s mail priority is set and that the mail is the correct format.
I made a workflow to work out of which looks like this
https://i.imgur.com/qp5jO8s.png
I’ve started off with this when I realized, I don’t know how to go to the next check.
Next person is Continue anywhere in the loop but I’m not sure how to go about going to the next check.
The next check would be checking the phonenumber and then grabbing that from Google if it is not listed, then checking if they are created in office 365 and to see if they are created with the correct email format.
#Complete check #region - Check AD $OUs = "Ou1"#,"Ou2"#,"Ou3","Ou4","Ou5" #Add or remove OUs to check each user in. foreach ($OU in $OUs){ $adusers = get-aduser -filter * -SearchBase "OU=$ou,OU=Users,DC=domain,DC=tld" -Properties * | where-object Enabled foreach ($aduser in $adusers){ #endregion #Check email write-host -ForegroundColor magenta "-------------" write-host -ForegroundColor magenta "-- AD INFO --" write-host -ForegroundColor magenta "First name:" $aduser.givenname write-host -ForegroundColor magenta "Last name:" $aduser.Surname write-host -ForegroundColor magenta "Email:" $aduser.mail write-host -ForegroundColor magenta "-------------" #build alias $alias = "" $alias = $aduser.GivenName + "." + $aduser.surname + "@domain.tld" $alias = $alias.Replace(" ","") if($aduser.mail -eq ""){#IsADemailEntered? #if no write-host -ForegroundColor Red $aduser.GivenName $aduser.Surname" email in AD is empty?!" if (gam info user $alias){#DoesAliasExists? #DoesAliasExists-YES write-host -ForegroundColor cyan "$alias does exist" # #set-aduser with that mail # }else { #DoesAliasExists-NO write-host -ForegroundColor Yellow "$alias does not exist and can be used for a new google account for" $aduser.givenname $aduser.Surname }#end if no #DoesAliasExist }#finish if yes for }#finish #IsADemailEntered? }#finish AD user loop }#finish OU loop
submitted by /u/sysadminworkaccount
[link] [comments]
The post Trying to create a PowerShell scheduled checklist.. checker appeared first on How to Code .NET.
got over a hurdle and onto the next, I have a API that I got the information I need but need formatted back
I am working with an API powershell call, I get my query results back fine; however, when exporting it seems it takes the object name instead of the results. if I do a | export-csv it messes up but if I go to | format-list it works. Is it possible to take a list format that I have in $results back to table format? for being exported to a csv?
submitted by /u/jdb5345
[link] [comments]
The post got over a hurdle and onto the next, I have a API that I got the information I need but need formatted back appeared first on How to Code .NET.
PS to sort files based on keywords in the filename.
I’m looking for a PS to look at the hundreds of files within as specific folder, then move files to other directories based on the name of the file.
ex. move all files containing “ocr” in the file name, into a folder called OCR. Move all files containing the word “logo” into a folder called logo. Then within each of those two folders, look for a list (about 130 names) and move the ones without those names into an “undetermined” folder.
I’m a complete novice with PS but I’m capable of reverse engineering others work to figure out how to make work for me. Honestly unsure where to start with this. Maybe PS isn’t the best option?
submitted by /u/NumerousImportance
[link] [comments]
The post PS to sort files based on keywords in the filename. appeared first on How to Code .NET.
different results running a script from a batch file
I wrote a script that parses folders for xml files and images. The script renames the images bases on info pulled from the xml. Everything works fine when I run the script from the ISE but when I execute it from a batch file, the first pass the ForEach doesn’t pull the information from the xml file. I saw something similar to this earlier, but I removed the variables from the end of each segment of the script and it fixed the issue. What am I doing wrong?
submitted by /u/edorbuddy
[link] [comments]
The post different results running a script from a batch file appeared first on How to Code .NET.
Edit SharePoint Edu Group site permissions
Hi,
I imported school data using SDS. Now I don’t want that any of the pupils are able to edit a SharePoint site that is connected to the imported and created groups? With > 800 pupils I need smth highly automated. Could somebody help me out here? Point me in the right direction? Thanks!
submitted by /u/blaqone
[link] [comments]
The post Edit SharePoint Edu Group site permissions appeared first on How to Code .NET.
Anyone know of a script or query to detect if a smart card is in the card reader of a remote PC?
Maybe something that ties in with ActivClient or just Windows 10 directly??
Any help would be greatly appreciated.
submitted by /u/Elementix
[link] [comments]
The post Anyone know of a script or query to detect if a smart card is in the card reader of a remote PC? appeared first on How to Code .NET.
Powershell support for hosted 365 email
Hi everyone, can 365 hosted email support powershell scripts executed from an RMM like Automate or N-Central?
submitted by /u/vonkoolaid
[link] [comments]
The post Powershell support for hosted 365 email appeared first on How to Code .NET.
Extracting HTML tables into PSobjects?
I’m using Invoke-WebRequest to get some data from a website, some of the data that i want it in a table, but they didn’t use the standard table header tags so getting the information (in a format i want) it proving to be a pain in the A$$.
The HTML looks like this.
I’ve come across this http://www.leeholmes.com/blog/2015/01/05/extracting-tables-from-powershells-invoke-webrequest/ and it works wonders when the tables have correct table header tags. Without it, it adds “p1” “p2” so on for the table headers which is good and i can format it as a table and hide table headers but i can’t then manipulate the data like that i want..
How i am trying to get the output is like so.
Serial : 111111111 FW Ver : G92.T FW Ver : 9999 LastResync: 2018-05-31 20:32:16 Primary : ConfigName1.cfg secondary config: ConfigName2.cfg Third config: ConfigName3.cfg Serial : 222222222 FW Ver : G92.T FW Ver : 4vg554 LastResync: 2018-05-31 20:32:16 Primary : ConfigName1.cfg secondary config: ConfigName2.cfg Third config: ConfigName3.cfg
I either need help on ways to extract the table table
OR using the script above, how to get the table data into a PsObject properly..
Any Ideas?
Thanks in Advance
submitted by /u/tadcrazio
[link] [comments]
The post Extracting HTML tables into PSobjects? appeared first on How to Code .NET.
Move all files with same extension from subfolders to current folder
I am trying to figure out a command that would do the following.
It is run in a folder then it finds all files in all sub folders with given extension, then it moves all the files that match to the folder where the command was ran from.
I have looked at move-item but can’t quite figure it out.
Thanks in advance for any help.
submitted by /u/Iwanttoknow-
[link] [comments]
The post Move all files with same extension from subfolders to current folder appeared first on How to Code .NET.
Update AD LastLogonTimeStamp via PowerShell?
I’m writing some scritps around LastLogonTimeStamp (I know about the replication complications with this attribute) and the only way I can test is to log on as a user so that they attribute gets updated. I’m unable to edit the value in ADSIEdit or ADUC. Is there a way in PowerShell to update this attribute?
submitted by /u/Yellephen
[link] [comments]
The post Update AD LastLogonTimeStamp via PowerShell? appeared first on How to Code .NET.
Infrastructure Testing with Pester and the Operation Validation Framework
The post Infrastructure Testing with Pester and the Operation Validation Framework appeared first on How to Code .NET.
trying to create a registry entry and getting error
I am very new to powershell for forgive me for the noob question. I did google this and could not get a clear answer on what Im doing wrong so I was hoping reddit could help.
I am trying to add a registry key and then at an item property.
When I run the portion that creates the key it says it succeeds but I haven’t seen the registry update with the key
When I try to add the item property I get an error and I don’t know what the error means.
here is the code
$registryPath = "HKEY_LOCAL_MACHINE/SOFTWARE/Policies/Google/Chrome" $Name = "IncognitoModeAvailability" $value = "1" IF(!(Test-Path $registryPath)) { New-Item -Path $registryPath -Confirm -Force New-ItemProperty -Name IncognitoModeAvailability -Path $registryPath -Confirm -Force -Value 1 } ELSE { New-ItemProperty -Name IncognitoModeAvailability -Path HKLM:SoftwarePoliciesGoogleChrome -Confirm -Force -Value 1}
and here is the error im getting
PS C:WINDOWSsystem32> New-Item -Path $registryPath -Confirm -Force New-ItemProperty -Name IncognitoModeAvailability -Path HKEY_LOCAL_MACHINE/SOFTWARE/Policies/Google/Chrome -Confirm -Force -Value 1 Directory: C:WINDOWSsystem32HKEY_LOCAL_MACHINESOFTWAREPoliciesGoogle Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 6/1/2018 11:12 AM 0 Chrome New-ItemProperty : Cannot use interface. The IDynamicPropertyCmdletProvider interface is not implemented by this provider. At line:3 char:5 + New-ItemProperty -Name IncognitoModeAvailability -Path HKEY_LOCAL ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotImplemented: (:) [New-ItemProperty], PSNotSupportedException + FullyQualifiedErrorId : NotSupported,Microsoft.PowerShell.Commands.NewItemPropertyCommand PS C:WINDOWSsystem32>
submitted by /u/infiniteapecreative
[link] [comments]
The post trying to create a registry entry and getting error appeared first on How to Code .NET.
Datanauts 136: ChatOps Using PoshBot With Brandon Olin
The post Datanauts 136: ChatOps Using PoshBot With Brandon Olin appeared first on How to Code .NET.
Use -lt to read cvs hard drive values
Hi,
I built a script that uses wmi to import all server values to a csv that I review each day.
The thing is that I want to automate this job so I only have to review the report with respect to monitoring drive space when the values found in the drive space column are beneath a threshold. At that point I want it to email the offending servers. I can take care of all the emailing parts.
I had some luck with this but it doesn’t appear to work right. It might have something to do with the object type not working correctly because it’s a string.
$data = import-csv servers.csv
$drives = $data.cdrive
Foreach($drive in $drives) { If([int]$drive -lt “7.0”)
{ Write-Output $drive }
}
This works but it doesn’t give me all the offenders. What it gives me is pretty much everything below 7.50 but nothing above like 7.70.
Ideas?
submitted by /u/raider111111
[link] [comments]
The post Use -lt to read cvs hard drive values appeared first on How to Code .NET.