My question is pretty simple, I've added a PowerShell script to the GPO Logon Scripts (PowerShell tab). Should I have a rule changing the ExecutionPolicy or Logon Scripts runs regardless of the local PowerShell ExecutionPolicy?
Thanks in advance.
My question is pretty simple, I've added a PowerShell script to the GPO Logon Scripts (PowerShell tab). Should I have a rule changing the ExecutionPolicy or Logon Scripts runs regardless of the local PowerShell ExecutionPolicy?
Thanks in advance.
For the life of me I cannot wrap my head around this.
I need to strip out the SID from a CN name.
CN=S-1-5-21-3732321167-3393826962-3131626954-1200,OU=Security Groups,,DC=Domain1,DC=com
I want to remove everything except the SID.
I have looked at the strip command, but I just cant understand how it works.....
Can anyone help me with creating a powershell script for downloading and uploading files from remote FTPS site.
I can upload and download the folder contents from a vanilla FTP site easily, but could not find a .net library that handles same from FTPS ( port 990) site. Has Microsoft abandoned FTPS?
Hi All,
Has anyone come across the requirement to extract files or data based on dynamic data range as per below requirements:
$FromDate = How to set as 21st of Last month dynamically to PowerShell Variable?
$ToDate - How to set 20th of Current month dynamically to PowerShell Variable?
Thanks for your help!
Cheers, Badal Ratra MCTS
Hi,
I am trying to install Exchange 2013 CU11 server remotely from DC via powershell v4.0. Script install required pre-requisite successfully along with required reboot, but during exchange installation, it fails with error message as "You must use an account that's a member of the Organization Management role group to install". However, I do this using administrator account. I have searched but solutions are available, while installing locally not remotely.
Set up is on Win2k12 R2
winrm set winrm/config/client '@{TrustedHosts = "exch1"}' Enter-PSSession exch1 Start-Sleep -s 5 $cred = Get-Credential auto\administrator Invoke-Command -ComputerName exch1 -Credential $cred -ScriptBlock{Install-WindowsFeature RSAT-ADDS} Invoke-Command -ComputerName exch1 -Credential $cred -ScriptBlock{Install-WindowsFeature AS-HTTP-Activation, Desktop-Experience, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation, RSAT-ADDS, Server-Media-Foundation} Start-Sleep -s 5 Restart-Computer -Wait -ComputerName exch1 -Force -For PowerShell Start-Sleep -s 5 Restart-Computer -Wait -ComputerName exch1 -Force -For PowerShell Start-Sleep -s 5 Invoke-Command -ComputerName exch1 -Credential $cred -ScriptBlock{& cmd.exe /c "c:\Utils\UcmaRuntimeSetup.exe" /passive} Invoke-Command -ComputerName exch1 -Credential $cred -ScriptBlock{& cmd.exe /c "c:\Utils\FilterPack64bit.exe" /passive} Invoke-Command -ComputerName exch1 -Credential $cred -ScriptBlock{& cmd.exe /c "c:\Utils\filterpack2010sp1-kb2460041-x64-fullfile-en-us.exe" /passive} Restart-Computer -Wait -ComputerName exch1 -Force -For PowerShell Start-Sleep -s 5 Invoke-Command -ComputerName exch1 -Credential $cred -ScriptBlock{& cmd.exe /c "c:\install1\setup.exe" /Mode:Install /role:ClientAccess,Mailbox /IAcceptExchangeServerLicenseTerms /InstallWindowsComponents /OrganizationName:MyOrg /DomainController:autodc.auto.local /DisableAMFiltering /MdbName:DB01 /DbFilePath:"E:\DB1Db\DB1.edb" /LogFolderPath:"F:\Db1Log"}
Failed with below error message:
Welcome to Microsoft Exchange Server 2013 Cumulative Update 11 Unattended Setup Copying Files... File copy complete. Setup will now collect additional information needed for installation. Languages Management tools Mailbox role: Transport service Mailbox role: Client Access service Mailbox role: Unified Messaging service Mailbox role: Mailbox service Client Access role: Front End Transport service Client Access role: Client Access Front End service Performing Microsoft Exchange Server Prerequisite Check Configuring Prerequisites ... COMPLETED You must be a member of the 'Organization Management' role group or a member of the 'Enterprise Admins' group to continue. + CategoryInfo : NotSpecified: (You must be a m...up to continue.:String) [], RemoteException+ FullyQualifiedErrorId : NativeCommandError+ PSComputerName : exch2 You must use an account that's a member of the Organization Management role group to install or upgrade the first Mailbox server role in the topology. You must use an account that's a member of the Organization Management role group to install the first Client Access server role in the topology. You must use an account that's a member of the Organization Management role group to install the first Client Access server role in the topology. You must use an account that's a member of the Organization Management role group to install or upgrade the first Mailbox server role in the topology. You must use an account that's a member of the Organization Management role group to install or upgrade the first Client Access server role in the topology. You must use an account that's a member of the Organization Management role group to install the first Mailbox server role in the topology. Setup encountered a problem while validating the state of Active Directory: Active Directory operation failed on . The supplied credential for 'AUTO\Administrator' is invalid. See the Exchange setup log for more information on this error. Either Active Directory doesn't exist, or it can't be contacted. Prerequisite Analysis ... FAILED The Exchange Server setup operation didn't complete. More details can be found in ExchangeSetup.log located in the <SystemDrive>:\ExchangeSetupLogs folder.
Kindly help to resolve this issue.
Thanks,
Sudhir
Hi Folks,
I am facing issues in enabling PSRemoting on some servers.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Enter-PSSession : Connecting to remote server failed with the following error message : <f:WSManFault xmlns:f="http://s
chemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2147749907" Machine="ABC.domain.local"><f:Message></f:Message></f:WSManFault> For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:16
+ Enter-PSSession <<<< ABC.domain.local
+ CategoryInfo : InvalidArgument: (ABC.domain.local:String) [Enter-PSSession], PSRemotingTranspor
tException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFaile
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Name Value
---- -----
CLRVersion 2.0.50727.1891
BuildVersion 6.0.6002.18111
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
Any help would be greatly appreciated.
Hi,
I am trying to get the date of last 3 working days but I want to skip weekends days if it falls in between. There will be no search from Saturday and Sunday. So the following what I would need:
On 20160707 I should get 2016-07-06, 2016-07-05, 2016-07-04
On 20160706 I should get 2016-07-05, 2016-07-04, 2016-07-01
On 20160705 I should get 2016-07-04, 2016-07-01, 2016-06-30
On 20160704 I should get 2016-07-01, 2016-06-30, 2016-06-29
I actually tried programmatically but did not get all values correct. Any smart Powershell way to do it?
Hey Geeks, I've the below array variable, which holds the below data-
FileName Status \\fileserver01\shareTax\File1 Exists \\fileserver01\shareTax\File2 To be Copied \\fileserver01\shareTax\File3 To be Copied \\fileserver01\shareTax\File4 To be Copied \\fileserver01\shareTax\File5 To be Copied \\fileserver01\shareTax\File6 To be Copied \\fileserver01\shareTax\File7 To be Copied \\fileserver01\shareTax\File8 To be Copied \\fileserver01\shareTax\File9 To be Copied \\fileserver01\shareTax\File10 To be Copied \\fileserver01\shareTax\File11 To be Copied
Please help me in exporting the array data to a csv file format, with the heading of "Filename" & "Status".
Do suggest a fix for this.
Cheers, Alan.
Hi,
Hoping someone can help. I need to create a script the will search registry keys (Including sub-keys) to find 2 entries and report there values. I need to do this for multiple servers I have listed in a TXT file.
I would like the output to read something like this:
Computername, Value1, Value2
Actually i am executing powershell script in winpe image, after booted the powershell will execute and do sudden task. part of the task i am checking members in AD group, for that i have already added AD powershell modules inside the winpe boot image and i can able to see the cmdlets. I have imported ActiveDirectory module and executing Get-AdgroupMember command I am getting " unable to connect the server. This may be because this server does not exist, it is currently down, or does not have the Active Directory Web Services running ".
I have checked the ADWS service in domain controller its up and running fine. I can execute the same command in normal windows server which is working fine. I have already tried to use Get-AdGroupMember with -Server property but still i am not able to reach the AD.
I have checked most of the forum all are asking to restart the ADWS service but in my case its working fine. Seeking help that how to map the ADWS service and get the output from Get-AdGroupMember in a variable.
Thanks in advance,
Babu
Babu
Hi,
In a Windows Server 2008R2 system, I changed the user interface from explorer.exe to powershell.exe, running a customized PS script. To do this, I setup a GPO to specific users (see: https://technet.microsoft.com/en-us/library/cc975911.aspx). The custom user interface is something like powershell.exe -windowstyle hidden c:\myscript.ps.
Ths PS script runs a LOB application and sits waiting for exit, then logoff the session. All works like a charm. Clients login through RDS.
Is there a way to initialize sound system from a PS script ?
Thanks.
Massimo.
I am trying to run:
get-adcomputer TESTPC | move-adobject -targetpath (Get-ADOrganizationalUnit -filter "name -eq '_TEST'")
I am trying to move hostname TESTPC to OU _TEST. I have both, but getting an error:
Move-ADObject : Cannot convert 'System.Object[]' to the type 'System.String'
I am also trying to move a user:
Get-ADUser testuser | Move-ADObject -TargetPath "CN=IE,OU=firefox,OU=chrome,DC=AD,DC=MLP,DC=com"
but getting the following error:
Move-ADObject : The object cannot be added because the parent is not on the list of possible superiors
Thanks for the help
Hello everyone,
Could you please point me to right direction? I need to refresh a GPO to refresh it on all computers to which it applies. Neither gpupdate /force nor Invoke-gpupdate look suitable in that case.
Thanks in advance
Hi All
I'm trying to write code to set-mailbox -type in Office 365. However, when I execute the action, I may get a warning that no change was made. I need to know if a change was made, or not. (Beyond the scope of this script, I'd just like to know how this is done, generally, too.)
I'm having real trouble capturing this data to see if the change was made or not for each of the thousands of users in the script.
The warning message is like this:
WARNING: Couldn't convert the mailbox because the mailbox "foo@foo.com" is already of the type "Room".
WARNING: The command completed successfully but no settings of 'foo' have been modified.
I've read various sites, but am unable to get anything to be trapped in a variable. I don't want to write a file with the warning message.
I've tried this: code:
$something = $(set-mailbox -Identity foo@foo.com -Type Room) 3>&1
However, the $something variable never contains the message. This seems like such a simple thing to do - it's driving me crazy! :p
Any help would be much appreciated!
Some reference sites:
https://blogs.technet.microsoft.com/heyscriptingguy/2012/09/20/powertip-redirect-powershell-warning-messages-to-a-text-file/
I have a problem where on some of my 2012R2 servers when I run
Invoke-command -ComputerName $server -ScriptBlock {Start-process -Filepath c:\temp\vcredist_x86.exe -ArgumentList "/install /q /norestart" -Verb RunAs -Wait}
the software installs just fine yet on many my script just stops at this point. Well maybe not exactly stops the execution but doesn't progress so I need to stop it myself. What could be the reason fro that and how to fix or overcome?
yaro
Hello
Using PowerShell I want to create script for following tasks
1. Create AD Account & Exchange Mailbox in on-premises and Sync new AD Objecy with Azure coud and assign license
2. Based on the new AD object time stamp, want User mailbox migrate to office365 cloud and assign license, litigation hold etc
3.. Once creation is completed email should trigger to user or manger on the id creation
4. How to delete AD Object and recover the license
5. Is the possible that Office365 mailbox will be put on in-place hold for eDiscovery using PowerShell?
Please advise
Avian
Hello Everyone,
I have a question for you:
it is possible to export via Powershell (Get-GPO etc.) all the Group Policy of my Domain, plus the OU that are Linked in them, in one CSV File? Thank you very much.
hi,
we need to generate the following script on shared mailbox in particular email addressed domain.
Exchange 2013 powershell script to generate shared mailbox list report with members, full access, sendas, send on behalf of permission in particular email addressed domain only. Ex: report only needs to contain testing.com.sg shared mailboxes. thus, not required all domain listed shared mailboxes.
============following script does not filtering particular domain testing.com.sg domain shared mailboxes=======
$OutFile = "C:\Temp\PermissionExport.txt"=======================================================================
any help..
MD
I was able to do a type() on the error and I found system.management.automation.validationmetadataexception for it. So I used a
try{ ... }catch [System.Management.Automation.ValidationMetadataException]{ do something first }catch{ do something rest }
When I put in input data that does not fit the validation set, it works and goes to the first catch block, but when I run a cmd utility that I use for work and it fails it also does what's in the first catch. When I review $Error[0], it is not a validationmetadataexception. What gives? It should be doing what's in the rest catch. The utility is dependent on 3 user inputs, so instead of doing a try catch for each input and one for the utility I figured to use one for the three inputs and one for the utility. The log I output to would tell me what line it failed on. Am I doing something wrong?