Thanks, @ricardosolisvillegas-4678
Does it require that we have premier support or pro support or regular support contract with Microsoft? Because it seems we will be engaged by MS support team. Any extra support charges/subscriptions we are looking at?
We are looking to migrate the following:
m365 (exchange online, one drive, teams, sharepoint online), policies, azure ad, ~300 apps, vault, backups, storage, VM's. What about duplicate names (different users) in multiple tenants? Also need to sync with on premises ADDS and Exchange Servers.
Or am I overcomplicating matters and it is just a switch to point to new tenant and will be done in collab with MS support?
$a = $Picture.Name -replace '[.]',''
$a = $a -replace '\D+([0-9]*).*','$1'
$a = $a -match '0*(?<Number>([1-9][0-9]*))'
$a = $Matches.Number
$a = $a -match '\d{5}'
$a = $Matches.Values
$a = [String]$a[0]
$a = [String]$a[0] does the trick. Now getting correct output.
But the below question still remains...
Regarding Regex, my idea is to pick the 5 digit number that is consecutive and that is non zero and also does not have zeros in the front. File formats can change but it will always have this 5 digit consecutive number. Also if the file format doesn't have this 5 digit consecutive number, then there should be an error handler to gracefully continue execution.
Regards,
BT
Apologize for the delayed response. Yes file name text would have been easier for you...will take care next time. btw...Its not required to have AD to test the code as we are testing the correct regex to use. yes those 2 file name patterns are not correct. That is fine.
Found a new pattern to consider. What if...we need to ignore the first 5 consecutive numbers if it starts with 1 or 2 or 3 and pick up another set of 5 consecutive numbers stating with 4 and above digits. If there are no 4 or above digits present next 5 consecutive numbers, then should show "pattern not found"
For example file name below:
00012345.00067890.b.t.jpg
00023456.00078901.b.t.jpg
00034567.00089012.b.t.jpg
00034567.00008901.b.t.jpg
00012345.00000000.b.t.jpg
Need to ignore the first 5 consecutive numbers stating with either 1,2 or 3 and pick the next 5 consecutive numbers if they start with 4 and above digits.
Note: The earlier requirement of not begin with 0 still applies.
Thank you,
Regards,
Biju
Thanks, Rich. However, when I run your code, it doesn't write to the host any information like whether Exists or Doesn't exists. The code just runs and completes without showing anything on the screen as output.
Regarding Regex, my idea is to pick the 5 digit number that is consecutive and that is non zero and also does not have zeros in the front. File formats can change but it will always have this 5 digit consecutive number. Also if the file format doesn't have this 5 digit consecutive number, then there should be an error handler to gracefully continue execution.
Thanks for help so far. Appreciate it.
Regards,
BT
Import-Module ActiveDirectory
$InputFolder = "Z:\Scripts\setuserthumbnailfoto\Input\"
$Pictures = Get-ChildItem $InputFolder -Filter .jpg
foreach ($Picture in $Pictures) {
$a = $Picture.Name -replace '[.]',''
$a = $a -replace '\D+([0-9]).','$1'
$a = $a -match '0(?<Number>([1-9][0-9]*))'
$a = $Matches.Number
$a = $a -match '\d{5}'
$a = $Matches.Values
Try {
$ADUser = Get-ADUser -Identity $a
}
Catch {}
if ($ADUser) {
Write-Host $a "Exists"
}
else {
Write-Host $a "Doesn't Exists!!!"
}
}
Hi,
I have an input folder that has files names as per attached pic:
I'm using the following script to get the 5 digit number from the filenames that is the logon name/samaccountname in our ad. Then query ad to check if the user exists or not.
Unfortunately, there are no errors to show...only that the output is coming as 'Doesn't Exists!!!':
I know all these users exists in AD, except for 67891. I'm not sure what am I doing wrong? Please help
Regards,
BT
Thanks! We have multiple other apps in the old tenant and need all of them be migrated. I know azure migrate can migrate the app servers in a group. But is there a way to ensure the network/storage settings also be migrated to the new tenant?