Clone Windows 10
convert .eml to .msg
I have 500000 .eml files that needs to be converted to .msg file and save in local folder.
I want to know if we have any powershell command to do so?
Or any other efficient method to achieve this??(C#)
PS: Dont want to use third party converters.
Create folder with current timestamp using powershell
how to Create folder with current time-stamp mm-dd-yyyy HH:MM:SS using powershell?
I was able to create thefolder with mm-dd-yyyy but not mm-dd-yyyy HH:MM:SS? Is it possible to create the folder with mm-dd-yyyy HH:MM:SS?
Bulk Disable Account but I need to compile Description field pls help
Hi to All Master of Powershell, I need your help
I need to do this in bulk witha ascript,
Before Move a User in another folder and then disable him, I need to do this (the name of the users are in a cvs):
Take what is write in the Object Tab (Canonical Name field), copy the content then paste in the description field (General TAB) but after waht is just write in. Example:
In description field I have got This: name.surrname
I need to obtain: name.surrname + "OU origin" paste what is was in Object tab filed + "Disalbed in xx/xx/2018"
what is in the "" are something i need to write
sorry for my english hope y can help me ;)
Azure Powershell Query to return VM details
Im trying to write a powershell query to return the following table:
NAME STATUS RESOURCE GROUP VMSIZE SIZEREASON (TAG) LOCATION PUBLIC DNS NAME
My Powershell query is currently:
Get-AzureRmVm `
| Select-Object ResourceGroupName `
, Name `
, Location `
, @{Name="VmSize"; Expression={$_.ToPSVirtualMachine().HardwareProfile.VmSize}} `
, @{Name="SizeReason(Tag)"; Expression={$_.ToPSVirtualMachine().Tags.Values}} `
, FullyQualifiedDomainName `
| Format-Table
The outstanding problems are:
FullyQualifiedDomainName does not work
I am also missing the status (Eg: Running, Stopped (Deallocated) etc..)
Can anyone help?
Where is System.Management.Automation?
Powershell is installed. This MSDN page mentions system.management.automation.dll, however searching for this file finds nothing.
Where is this library?
Thanks,
Carol
http://www.wapshere.com/missmiis
Remote execution of a sqlcompare.exe seems to hang or stop when using the Invoke-WmiMethod –class Win32_process
Hi,
We are trying to Remotely execute sqlcompare.exe but it seems to hang or stop when using the Invoke-WmiMethod –class Win32_process.
When I run the exact same command on the local machine that has sqlcompare installed, then it works.
The command is essentially this.
[string]$Cmd = "e:\tools\synchronizedbs.bat $ScriptSource $Database2 $Sqlserver2 $Username2 $Password2 >> e:\tools\sync.log"
The powershell command is....
Invoke-WmiMethod –class Win32_process -name Create -ArgumentList ($Cmd) -ComputerName $Hostname -Credential $cred -erroraction Stop
the actual result from this execution in the sync.log file is
C:\Windows\system32>"C:\Program Files (x86)\Red Gate\SQL Compare 13\sqlcompare.exe" /activateserial:sdfsdfsdfsfE88B /scripts1:E:\Remotescriptsource\CDR /database2:CDR /server2:ServerName /username2:%%%% /password2:%%%%% /sync /ScriptFile:E:\scriptfiles\scriptfileCDR
/options:ForceColumnOrder,IgnoreUsers,IgnorePermissions,IgnoreWhiteSpace,IgnoreUserProperties,IgnoreCollations,IgnoreConstraintNames,IncludeDependencies /exclude:User /exclude:Role /exclude:Synonym /include:identical
SQL Compare Command Line V13.4.0.6563
==============================================================================
Copyright c 1999 - 2018 Redgate Software Ltd
That is all that it shows
On a successful run on the local machine it would show this.
C:\Windows\system32>"C:\Program Files (x86)\Red Gate\SQL Compare 13\sqlcompare.exe" /activateserial:xxxxxE88B /scripts1:E:\Remotescriptsource\CDR /database2:CDR /server2:ServerName /username2:%%%% /password2:%%%%% /sync /ScriptFile:E:\scriptfiles\scriptfileCDR
/options:ForceColumnOrder,IgnoreUsers,IgnorePermissions,IgnoreWhiteSpace,IgnoreUserProperties,IgnoreCollations,IgnoreConstraintNames,IncludeDependencies /exclude:User /exclude:Role /exclude:Synonym /include:identical
SQL Compare Command Line V13.4.0.6563
==============================================================================
Copyright c 1999 - 2018 Redgate Software Ltd
SQL Compare: activated, edition professional, serial number: xxxxxE88B
Any ideas? Any thoughts on what do try next or how to debug?
Thanks in advance.
Thanks Lance
repeat script options
I'm a powershell nube that needs some help.
I have a script that works, basically its creating network locations in windows 10 to replace mapped drives.
It uses two variables, one for the name of the location, and one for the UNC path of the target.
I would like to create a single script that runs through this process several times with different values for the two variables each time.
Is there a more efficient way to do this beyond just copy/paste the entire process and changing the variable values? some way to repeat but with different values?
$name='Name' $Target='\\servername\sharename' $networkshortcut_name = $Name $networkshortcut_target = $Target $networkshortcuts_path = [Environment]::GetFolderPath('NetworkShortcuts') $networkshortcut_path = "$networkshortcuts_path\$networkshortcut_name" $desktopini_path = "$networkshortcut_path\desktop.ini" $targetlnk_path = "$networkshortcut_path\target.lnk" $desktopini_text = "[.ShellClassInfo]`r`nCLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}`r`nFlags=2" if( Test-Path -Path $networkshortcut_path -PathType Container ) { Remove-Item -Path $networkshortcut_path -Recurse -Force } [void](New-Item -Path $networkshortcut_path -ItemType directory) Set-ItemProperty -Path $networkshortcut_path -Name Attributes -Value 1 Out-File -FilePath $desktopini_path -InputObject $desktopini_text -Encoding ascii Set-ItemProperty -Path $desktopini_path -Name Attributes -Value 6 $WshShell = New-Object -com WScript.Shell $Shortcut = $WshShell.CreateShortcut($targetlnk_path) $Shortcut.TargetPath = $networkshortcut_target $Shortcut.Save()
any help would be appreciated
GetSecurityDescriptor from WMI with nonexisting user in result list
I have a script with which I can add users/groups to the security settings of a WMI class. This script run's fine except when a nonexisting user has access tot the WMI class
The problem part of the script is the first line below
$output = Invoke-WmiMethod -Namespace root/cimv2 -ComputerName computer1 -Path "__systemsecurity=@" -Name GetSecurityDescriptor $acl = $output.Descriptor $acl.DACL
When I run this script while a nonexisting user has access to the WMI class, I get an "Unexecpted Error". When I remove this user (S-1-5-21-xxxxxxxxxxxxx) through "Computer Manager", "WMI Control", "Properties", "Security", the script runs fine.
Is there a method to remove nonexisting users from WMI Classes, or to skip this user.
The error I get is:
Invoke-WmiMethod : Unexpected error
At line:1 char:18
+ $output = Invoke-WmiMethod -Namespace root -ComputerName computer1 -Path ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-WmiMethod], ManagementException
+ FullyQualifiedErrorId : InvokeWMIManagementException,Microsoft.PowerShell.Commands.InvokeWmiMethod
How to reconstruct a Forest name with the 'DC' moniker
Hi,
The goal is to add the 'DC=" moniker and a comma for all qualifiers in a Forest name, then store it in a variable for use in a subsequent command.
Based on the code below, I get a list of all Forests we have a trust to, then split thetarget property into qualifiers. Each Forest will have a variable number of qualifiers, which I determine based on the split with count method. So if the $Forest.Target = biz.mycompany.com, the $Array will contain all 3 qualifiers and the $Qualnumber will give me the count of qualifers.
The tough part is to now construct the target in the form 'DC=biz,DC=mycompany,DC=com' and store in a varialbe for subsequent use. I started a loop to iterate through each target where I can add the $DC and $Comma variables, but that is as far as I got. Any suggestions on how to rebuild the target is appreciated.
$DC = 'DC=' $Comma = ',' $AllForests = Get-ADTrust -Filter * | Sort Target | Select Target Foreach ($Forest in $AllForests) { $Array = ($Forest.Target -split '\.') $QualNumber = ($Forest.Target -split '\.').count $i=1 for ($i; $i -le $QualNumber; $i++) {Code here to dynamically build Forest name with DC component } }
Thanks for your help! SdeDot
IP address display
in my company we set up a script to retrieve the IP address of a user using a 3G key to connect to our network VPN. except that the script should also return an IP even if the 3G key is not introduced. Unfortunately this does not work if we do not have a key.
would it be possible to have your help.
thank you
No here thinks its possible to solve this powershell problem. Can you do it?
Scripting Task #1
Due on or before Monday 10/8/18
Completing the task earns 5 points
earn bonuses of up to 15 points
Create a script that reads input from the user. Collect their name and birthday
Output to the screen: Hello <NAME> you are <DAYS> days old!
Example output: Hello Brian Clark you are 13918 days old!
Commands used:
Read-Host
Write-Host
New-Timespan
Get-Date
Get-Help / Get-Help <cmd> -online
Bonus:
1) Calculate and output the age in years instead of days (2 points)
2) Format years as a whole number with no decimal places (3 points)
3) Ensure <Name> is in green text and <Days> or <years> is yellow (5 points)
4) ensure birthday is an actual date and error if not (5 points)
Creating users via Powershell
Hi
First post here. I'm looking for a script that does 2 things
1. Create an AD User account
In fact I have this already, it takes a list of users from a CSV file and creates an on prem AD account for each user
However it then needs to do the following
2) Sleep for a predetermined length of time to allow for the AD account to become synchronised up to Azure AD via Azure AD Connect
3) Assign an O365 Business Essentials licence and then create an O365 mailbox for this new user.
Things to note
- Single AD domain
- Email services are cloud only, there is no hybrid or on-prem exchange, nor has their ever been. This is a brand mew company
- As such there has been No AD Prem and nowhere is there an installed Exchange Management Tools/Shell. Everything messaging related needs to be done against the 365 Powershell
- It would be nice to have a single script that does this end to end, but if I need two scripts then that will be OK, especially if they can both work from the same .csv file
Any pointers here would be great
Thanks all
Mike
Active Directory User - Export Attributes to CSV
I am trying to figure out how I can see the list of different AD User attributes.... Select what I want to display, and then export to CSV.
Some of the necessary attributes will be Username, Display Name, Email Address, User Creation Date, Enabled/Disabled?
Any help would be appreciated.... I am a complete Powershell Newbie!!
Brian Modlin
Registration to Microsoft TechNet Wiki competition for October 2018 is Opened! You can be the next PowerShell Guru
What is TechNet Guru Competition?
Each month the TechNet Wiki council organizes a contest of the best articles posted that month. This is your chance to be announced as MICROSOFT TECHNOLOGY GURU OF THE MONTH!
One winner in each category will be selected each month for glory and adoration by the MSDN/TechNet Ninjas and community as a whole. Winners will be announced in dedicated blog post that will be published in Microsoft Wiki Ninjas blog, a tweet from the Wiki Ninjas Twitter account, links will be published at Microsoft TNWiki group on Facebook, and other acknowledgement from the community will follow.
Some of our biggest community voices and many MVPs have passed through these halls on their way to fame and fortune.
If you have already made a contribution in the forums or gallery or you published a nice blog, then you can simply convert it into a shared wiki article, reference the original post, and register the article for the TechNet Guru Competition. The articles must be written in October 2018 and must be in English. However, the original blog or forum content can be from before October 2018 .
Come and see who is making waves in all your favorite technologies. Maybe it will be you!
Who can join the Competition?
Anyone who has basic knowledge and the desire to share the knowledge is welcome. Articles can appeal to beginners or discusse advanced topics. All you have to do is to add your article to TechNet Wiki from your own specialty category.
How can you win?
- Please copy/Write over your Microsoft technical solutions and revelations to TechNetWiki .
- Add a link to your new article on THIS WIKI COMPETITION PAGE (so we know you've contributed)
- (Optional but recommended) Add a link to your article at the TechNetWiki group on Facebook . The group is very active and people love to help, you can get feedback and even direct improvements in the article before the contest starts.
Do you have any question or want more information?
Feel free to ask any questions below, or Join us at the official MicrosoftTechNet Wiki groups on facebook . Read More about TechNet Guru Awards .
If you win, people will sing your praises online and your name will be raised as Guru of the Month.
PS: Above top banner came from Vimal Kalathil.
![]() | Ronen Ariely [Personal Site] [Blog] [Facebook] [Linkedin] |
Get members list from multiple AD groups
Please help me out. What I'm doing is importing 16 AD groups in a PowerShell script and finding the list of users in those AD groups. I am doing this for audit purpose.
Since I'm exporting the user list for 16 AD groups, the -append parameter is making the list of users in the output file appear one next to it and I couldn't figure out which user belongs to which group, since there are 450 to 500 users in the output file. I need some changes in the below script so that each user appears with the group name for which it is extracted.
Example- script run for first AD group- lists 4 users in that AD group. The script runs again for another AD group, this should display with the users' list along with the Group name which is trying to export the list. Hope I am not complicating it. Please help me out.
$groups = Get-content -path "C:\Users\Santosh\OBIP.csv"
foreach ($GroupName in $groups)
{
Get-ADgroupmember -Id $GroupName -Recursive | Where objectclass -eq 'user' | Get-ADUser -Properties Displayname,GivenName,Surname,UserPrincipalName,Title,Department,Enabled,ObjectClass, memberof | Select DistinguishedName, samAccountName, Name, Displayname, GivenName, Surname, UserPrincipalName, Title, Department, Enabled, ObjectClass | export-csv -path "C:\Users\Santosh\OBIP\GN.csv" -Append
}
Clone Windows 10
Windows Batch Files
Hello Folks!
Can someone help me create a batch script with the below basis?
Stop a Windows service and if the service doesn't stop successfully it will do the taskkill to force stop and then restart the service afterwards.
I can do the Stop and start command but I want to put the "IF" option and perform the taskkill and I just don't know the command.
Thanks in advance.
Regards,
-KeNN
When extracted the file name and sub directories to file , It doesnot show full name,
I wanted to extract the files name in all teh sub directores , and out to a txt file
But when see the output of file, the name of file is not in full, at the en it has ...
I use this script
$path="c:\Nadeem"
$NoOfDirs=Get-ChildItem $path -Directory -force
ForEach($dir in $NoOfDirs )
{
Get-ChildItem "$path\$($dir.name)" -force -Recurse |
Where-Object {$_.LastWriteTime -gt ([DateTime]::Now.Adddays(-730))} |
Select-Object @{l='Folder';e={$dir.Name}},Name,length, LastWriteTime |
Sort-Object -pro LastWriteTime -Descending |
Select -First 15
}
I see the out as this
ANy suggestion
Set-ClusterStorageSpacesDirectDisk cmdlet
In PowerShell version 5.1.17763.1 the cmdlet Set-ClusterStorageSpacesDirectDisk parameter -PhysicalDiskIds changed to
-PhysicalDisk and -PhysicalDiskGuid
I'm trying to set -CanBeClaimed $false to specific disks, but the new parameters do not accept the physical disks IDs.
What are the required inputs for the new parameters? Thank you.