powershell-2.0

Import-Module with -force removes imported module function?

限于喜欢 提交于 2021-02-19 03:38:04
问题 I have "ModuleA" that imports functions from modules "ADAutoDeployUtilities" and "Common_LoggingNotifications" using the code below. However, I keep receiving the exception (listed below) when I try to import Common_LoggingNotifications using -force. If I do not load Common_LoggingNotifications, only the ADAutoDeployUtilities functions are imported (which doesn't include writeJobLog) and everything runs fine, although I get the indicated exception when running on the server. I have also

Method Invocation .Foreach failed, System.Object doesn't contain a method named 'foreach'

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-11 14:01:34
问题 I am trying to execute a script in PowerShell 2.0 that will check the trust relationship between the computer and domain controller for all computers in Active Directory. I got the code from this website: https://adamtheautomator.com/trust-relationship-between-this-workstation-and-the-primary-domain-failed/ Here is the code: $localCredential = Get-Credential @(Get-AdComputer -Filter *).foreach({ $output = @{ ComputerName = $_.Name } if (-not (Test-Connection -ComputerName $_.Name -Quiet

Is it possible to set a users memberOf property in Active Directory using Powershell

北战南征 提交于 2021-02-09 08:20:05
问题 I need to create a Powershell script that sets some user attributes in Active Directory. I'm using the Set-AdUser command and passing in a user object as follows: $user = Get-AdUser -Identity $userIdentity $user.MemberOf = $dn_of_group Set-ADUser -Instance $user this returns an error of 'The adapter cannot set the value of property "MemberOf"'. Is it possible to set the MemberOf property from powershell? If so, what am I doing wrong? 回答1: You cannot modify the MemberOf property - you need to

Is it possible to set a users memberOf property in Active Directory using Powershell

家住魔仙堡 提交于 2021-02-09 08:18:06
问题 I need to create a Powershell script that sets some user attributes in Active Directory. I'm using the Set-AdUser command and passing in a user object as follows: $user = Get-AdUser -Identity $userIdentity $user.MemberOf = $dn_of_group Set-ADUser -Instance $user this returns an error of 'The adapter cannot set the value of property "MemberOf"'. Is it possible to set the MemberOf property from powershell? If so, what am I doing wrong? 回答1: You cannot modify the MemberOf property - you need to

Powershell fastest directory list

梦想与她 提交于 2021-02-07 08:17:33
问题 Anyone know a fast way to do a recursive directory listing? I am trying to go through a SAN of about 10tb and "get-childitem -include" takes days to run... I know there will be no way to bring it down to minutes but perhaps some way to cut the time to a few hours would be great. I only need a list i can sort through don't need the file properties as I will be using this to find certain types of files on our SAN such as PST files. If anyone could point me in the direction on how to use the

Powershell fastest directory list

僤鯓⒐⒋嵵緔 提交于 2021-02-07 08:14:24
问题 Anyone know a fast way to do a recursive directory listing? I am trying to go through a SAN of about 10tb and "get-childitem -include" takes days to run... I know there will be no way to bring it down to minutes but perhaps some way to cut the time to a few hours would be great. I only need a list i can sort through don't need the file properties as I will be using this to find certain types of files on our SAN such as PST files. If anyone could point me in the direction on how to use the

Powershell fastest directory list

橙三吉。 提交于 2021-02-07 08:13:03
问题 Anyone know a fast way to do a recursive directory listing? I am trying to go through a SAN of about 10tb and "get-childitem -include" takes days to run... I know there will be no way to bring it down to minutes but perhaps some way to cut the time to a few hours would be great. I only need a list i can sort through don't need the file properties as I will be using this to find certain types of files on our SAN such as PST files. If anyone could point me in the direction on how to use the

Powershell fastest directory list

◇◆丶佛笑我妖孽 提交于 2021-02-07 08:13:02
问题 Anyone know a fast way to do a recursive directory listing? I am trying to go through a SAN of about 10tb and "get-childitem -include" takes days to run... I know there will be no way to bring it down to minutes but perhaps some way to cut the time to a few hours would be great. I only need a list i can sort through don't need the file properties as I will be using this to find certain types of files on our SAN such as PST files. If anyone could point me in the direction on how to use the

Why is my locally-created script not allowed to run under the RemoteSigned execution policy?

妖精的绣舞 提交于 2021-02-05 12:41:40
问题 Since this question continues to attract responses that are either refuted by the question body or don't address the actual problem, please read this simple summary of what you need to know: This is not a "Why won't my default installation of PowerShell run scripts?" question. This is not a "Why won't my installation of PowerShell run scripts downloaded from the internet?" question. The question is why the RemoteSigned execution policy is preventing script execution when it shouldn't.

Why is my locally-created script not allowed to run under the RemoteSigned execution policy?

懵懂的女人 提交于 2021-02-05 12:41:09
问题 Since this question continues to attract responses that are either refuted by the question body or don't address the actual problem, please read this simple summary of what you need to know: This is not a "Why won't my default installation of PowerShell run scripts?" question. This is not a "Why won't my installation of PowerShell run scripts downloaded from the internet?" question. The question is why the RemoteSigned execution policy is preventing script execution when it shouldn't.