HPlum78
Members-
Posts
1,530 -
Joined
-
Last visited
Content Type
Forums
News
20th
EduGeek EDIT Conference
Blogs
Everything posted by HPlum78
-
Hmmm, not my area I will be honest I am technical, other (better people) than me are in charge of the money round here.
-
iGrasp is the thing you have seen Unis using along with others like some prisons.... it's what we use here at UoL. Hope this helps. http://www.lumesse.com/recruitment-software
-
As I am lazy I do not often spend time functionalising my scripts but this quite often gets me into trouble! so here it is wrapped up in a function for your delectation :- function Find-StringInGPO { <# .SYNOPSIS Finds a string in the GPOs of a Domain - Created by Harry Plumtree. .DESCRIPTION Gets all the GPOs in a Domain and searches for the supplied string, default output location is set to c:\temp\ .EXAMPLE Find-StringInGPO -SearchString DC1 explains how to use the command can be multiple lines .EXAMPLE Find-StringInGPO another example can have as many examples as you like #> param ( [Parameter(Position=1)] [string] $OutFile = "c:\temp\GPOsWithString.csv", [Parameter(Mandatory=$true, Position=0)] [string]$SearchString ) # Vars $Date = Get-date # Set the domain to search for GPOs $DomainName = $env:USERDNSDOMAIN # Find all GPOs in the current domain Write-Output -InputObject ('Finding all the GPOs in {0}' -f $DomainName) Import-Module -Name grouppolicy $allGposInDomain = Get-GPO -All -Domain $DomainName Add-Content -Path $OutFile -Value ('############### {0} ###############' -f $Date) Add-Content -Path $OutFile -Value ('############### {0} #####################' -f $SearchString) Add-Content -Path $OutFile -Value '###################################################' # Look through each GPO's XML for the string Write-Output 'Starting search....' foreach ($gpo in $allGposInDomain) { $report = Get-GPOReport -Guid $gpo.Id -ReportType Xml if ($report -match $SearchString) { Write-Output ('---> Match found in: {0} <---' -f $gpo.DisplayName) Add-Content -Path $OutFile -Value $($gpo.DisplayName) } else { Write-Output ('No match in: {0}' -f $gpo.DisplayName) } } } Now the only reason I have got this far, if I am honest is by using isesteroids from here http://www.powertheshell.com/isesteroids/ I am sure that I have mentioned this useful little utility in the past but the more I use it the more I like it, and is a must for anyone writing PowerShell.
-
######## Saves output to E:\Local\GPOReports\GPOs_With_DCs.txt this folder structure and file should be created before running. ########## # Vars $OutFile = "E:\Local\GPOReports\GPOs_With_DCs.txt" $Date = Get-date # Get the string we want to search for $string = Read-Host -Prompt "String to Search" # Set the domain to search for GPOs $DomainName = $env:USERDNSDOMAIN # Find all GPOs in the current domain write-host "Searching for GPOs in $DomainName" Import-Module grouppolicy $allGposInDomain = Get-GPO -All -Domain $DomainName Add-Content -Path $OutFile -Value "############### $Date ###############" Add-Content -Path $OutFile -Value "############### $string #####################" Add-Content -Path $OutFile -Value "###################################################" # create XML report and for each GPO and then search Write-Host "Starting search...." foreach ($gpo in $allGposInDomain) { $report = Get-GPOReport -Guid $gpo.Id -ReportType Xml if ($report -match $string) { write-host -fore Magenta "---> Match in: $($gpo.DisplayName) <---" Add-Content -Path $OutFile -Value $($gpo.DisplayName) } else { Write-Host -fore Green "No in: $($gpo.DisplayName)" } } # End The above will let you search all the GPO's in a domain for a string, it outputs to a file **Make sure you change the path! maybe some use if you do not have access to AGPM. It needs the group policy module.
-
Now I have had a bit of a poke around there is a Win32_QuotaSetting class maybe that would do you.
-
Not sure that WMI has any hooks into the quota subsystem, I think it's part of FSRM so unless all your workstations have RSAT installed running a logon script at logon would not work so well, and also a little pointless as you would do your quota reporting server side I would imagine. Anyhow I think it's get-fsrmquota in fact look here https://technet.microsoft.com/en-us/library/jj900651.aspx I think there are OS dependencies mind.
-
Set-Location E:\Local\Tmp #Parent Folder - where the files live $FileList = Get-ChildItem -Recurse | ? {$_.Extension -eq ".doc"} #Gets a list of files where the Extension is = to .DOC # foreach-object loop gets the name of the file and then builds a new file name with the replacement extension - in this case .DOCX $FileList | % { $FileNameNew = $_.BaseName + ".docx" Rename-Item -Path $_.PSPath -NewName $FileNameNew } # End PowerShell? the above will do what you want, you ask for a script so you get a........ Right that will work, forgot about sub-folders!
-
$OSVer = [environment]::OSVersion.Version if ($OSVer.Major -like "10") { $WShell = New-Object -ComObject ("WScript.Shell") $ShortCut = $WShell.CreateShortcut($env:USERPROFILE + "\Desktop\Lync.lnk") $ShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office16\Lync.EXE" $ShortCut.WorkingDirectory = "C:\Program Files\Microsoft Office\Office16" $ShortCut.WindowStyle = 1 $ShortCut.IconLocation = "C:\Program Files\Microsoft Office\Office16\Lync.ico, 0" $ShortCut.Description = "Office Lync 2016" $ShortCut.Save() } elseif ($OSver.Major -like "6*") { $WShell = New-Object -ComObject ("WScript.Shell") $ShortCut = $WShell.CreateShortcut($env:USERPROFILE + "\Desktop\Lync.lnk") $ShortCut.TargetPath = "C:\Program Files (x86)\Microsoft Office\Office16\Lync.EXE" $ShortCut.WorkingDirectory = "C:\Program Files (x86)\Microsoft Office\Office16" $ShortCut.WindowStyle = 1 $ShortCut.IconLocation = "C:\Program Files (x86)\Microsoft Office\Office16\Lync.ico, 0" $ShortCut.Description = "Office Lync 2016" $ShortCut.Save() } If I where doing it in PowerShell it would look a little like that, although you could just use a security filter on a GPO and just apply the GPO to the right set of work stations, If you see what I am saying. You could use gp prefs to create the short cut and dispense of the scripts all together. Anyhow that's a few options to consider.
-
Bit of fun - who has the oldest (working) Windows domain?
HPlum78 replied to 3s-gtech's topic in General Chat
Test-ComputerSecureChannel - repair win 8 on if my memory serve me right or as @ADMaster has posted Reset-ComputerMachinePassword -Server dchostname -Credential Get-Credential or if you want old school CMD netdom.exe resetpwd /s: /ud: /pd:* -
Bit of fun - who has the oldest (working) Windows domain?
HPlum78 replied to 3s-gtech's topic in General Chat
The old domain here was 2 weeks older than Microsoft's own domain, all migrated to a new one now mind. For those of you who have aging domains, RID Pool depletion? if you create large numbers of accounts/ other ad objects..... How to Protect your Active Directory from RID Pool Depletion - TechNet Articles - United States (English) - TechNet Wiki -
No problem, I often write scripts to do a job and then sit saying to myself I could do this or that to make it better. Thing is I produce a lot of scripts for doing various things and sometimes I have to just let them go and add it to the backlog. Never gets done mind.
- 7 replies
-
- 1
-
-
- home folders
- leavers
-
(and 2 more)
Tagged with:
-
$movesource = \\server\HomeFolders$\$($user.samaccountname)" Thing is you are setting the above var outside of your loop for moving the folder, you need to set the var after each iteration. Like I have done here:- $users | % { $fldrLoc = "$movesource$($_.SamAccountName)" write-host $flsrLoc Move-Item -Path $FldrLoc -Destination $movedestination -force } don't forget that its a top down run, so any declarations at the top of your script are static, any var that's needs to be redefined has to be done inside of your looping logic. (think that makes sense!)
- 7 replies
-
- home folders
- leavers
-
(and 2 more)
Tagged with:
-
So the reason it is not throwing an error is down to the construct of that $movesource var what is being passed is the root as and as far as the script is concerned that's fine.... anyhow something like this will get you on the way # Variables $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://server.domain.co.uk/PowerShell/ -Authentication Kerberos $OU = "domain/leavers/staffleavers" $Search = "OU=StaffLeavers,OU=Leavers,DC=domain,DC=co,DC =uk" $user = Get-ADUser -Filter * -SearchBase $Search $filepath = \\server\archive$\PST $Users = Get-ADUser -Filter -SearchBase $Search $movesource = \\server\homefolders$\ $movedestination = "\\server\archive$" # Move leavers home folder to Archive share $users | % { $fldrLoc = "$movesource$($_.SamAccountName)" write-host $flsrLoc Move-Item -Path $FldrLoc -Destination $movedestination -force } ##### End Its rough round the edges but its a starter for 10, the write-host bit can go its just a visual way to check the folder path looks like it should. Could do with some error catching in this type of script just in case it starts to do something bat sh*t crazy! it should be enough to get you on your way mind. I will call out % is short hand (alias) for ForEach-Object
- 7 replies
-
- home folders
- leavers
-
(and 2 more)
Tagged with:
-
Where is the var $userhome.name being defined or am I just not seeing it?
- 7 replies
-
- home folders
- leavers
-
(and 2 more)
Tagged with:
-
Exchange 2010 sp3 rollup package install failure
HPlum78 replied to randle's topic in Enterprise Software
I sorta guessed that you would have to be honest, I did see something about running the update with a switch to rebuild a .msp file (maybe). Give me a few and I will see if I can dig it out, and if it applies.- 11 replies
-
- exchange
- install problems
-
(and 1 more)
Tagged with:
-
Exchange 2010 sp3 rollup package install failure
HPlum78 replied to randle's topic in Enterprise Software
Right my bad had it in my head that you where installing SP3..... any how have you tried to install update 15 and skip 12/13/14? https://www.microsoft.com/en-us/download/details.aspx?id=53678- 11 replies
-
- exchange
- install problems
-
(and 1 more)
Tagged with:
-
Exchange 2010 sp3 rollup package install failure
HPlum78 replied to randle's topic in Enterprise Software
Anyhow if you have the UM role installed along with any other roles and have any other lang pack other than US installed you need to uninstall those before you install SP3. I think that's right if my memory serves me! but not sure if that error you are seeing is directly related to that but worth a punt.......- 11 replies
-
- exchange
- install problems
-
(and 1 more)
Tagged with:
-
Exchange 2010 sp3 rollup package install failure
HPlum78 replied to randle's topic in Enterprise Software
is the mail server running any UM stuff?- 11 replies
-
- exchange
- install problems
-
(and 1 more)
Tagged with:
-
$env:Path will return what is in the Path Enviroment Variables in PowerShell. To add to env:Path you need to read out the existing path and then add your new path(s) so a bit like this:- $envReg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment" $envNewPath = "c:\Program Files\ampl\xpress;c:\Program Files\ampl" $envOldPath = (Get-ItemProperty -Path "$envReg" -Name PATH).Path $envNewPath = $envOldPath + ’;’ + $envNewPath Set-ItemProperty -Path "$envReg" -Name PATH –Value $envNewPath -Confirm Or if you just need a process level Enviroment variable $env:xpressPath = "c:\Program Files\ampl\xpress" Think that makes sense! I would guess you would be best updating the Path env with the new paths as in the first example. I am not getting your matching logic "*"+$var"*" anyhow I am not on a device with >_ and have had the best part of 4 hours! sleep in the past 24, not firing on all cylinders!
-
PowerShell? $UsrNames = get-aduser -Filter * -SearchBase "OU=UsersToDelete,OU=Users,DC=YouDomain,DC=co,DC=uk" $UsrNames | % { remove-item $_.HomeDirectory -force -recurse remove-aduser -identity $_. -force } so the above is a simplistic approach to removing users and the data if everything is on the one server, if the user data is on a file server then you may have to wrap the remove-item commands in an invoke-command -scriptblock affair, or ps session approach. Also would be a good idea to put in some error trapping and reporting on what is going on to a file. not on a device that has PowerShell on so am not able to test this and as such is from memory, take care not to delete more than you require! more information here https://technet.microsoft.com/en-us/library/ee176938.aspx https://technet.microsoft.com/en-gb/library/ee617206.aspx https://technet.microsoft.com/en-gb/library/ee617241.https://blogs.technet.microsoft.com/heyscriptingguy/2011/11/30/use-powershell-to-find-and-remove-inactive-active-directory-users/
-
If its server 2012 > new-smbshare, so something like new-smbshare -Name Myshare1 -path c:\myshare\share1 -fullaccess yourdomain\Administrator, yourdomain\user1 $fldrlist = gci c:\mysharedfolder\ $fldrlist | %{ New-smbshare -name $_.Name -path $_.FullName -fullaccess youdomain\Administrator, yourdomain\user } this will get all the folders and then we can pipe them into a foreach loop Before windows 2012/ 8 no such thing as new-smbshare so would have to use the Win32_Share WMI Class $wmiShare[WMICLASS]"WIN32_Share" a method of the Win32_Share class is create so it would look something like this $wmiShare.create("c:\myshare\share1","MyShare1",0) this would do about the same as new-smbshare, the same looping methodology could be applied like above need to think about how to pull the right bits in to it. I am not sat at a device that has PowerShell on so the above code is from memory and has not been run! oh and just to save trouble aliases in the above are GCI = Get-ChildItem and % = ForEach-Object
-
oh and while on useful stuff take a look at the following PowerTheShell – PowerShell Resources ISESteroids its not free but is worth it if you do a lot of >_ (Like I do!)
-
Another good resource here - A Practical Guide for Using Regex in PowerShell
