Quantcast
Channel: Windows PowerShell forum
Viewing all 21975 articles
Browse latest View live

Powershell to give Domain User Logon As Service rights

$
0
0

Hi,

I am a newbie to PowerShell and Windows Administration stuff. I was wondering if there is any PowerShell script to give a Domain User "Logon As Service" rights in one of our servers. I found people using the Carbon.dll for achieving this and the NTRights utility.

I tried out using the NTRights, but it appears I need to install it? I am trying to do it in Windows Server 2008-2012 R2. I am not too keen on installing NTRights module (if it is required), as installing something new is not something I would prefer.

Is there any PowerShell command as such (or anything Out-Of-The-Box in Windows) by which I can achieve my requirement? I need to do this using command line, so no GUI stuff here.


Admin QuikView Solution for CRM 2013


invoke-command takes 20-90 seconds to complete

$
0
0

all servers I'm testing with is server 2008r2 with powershell 4.  I have a text file with 100 servers that are online and with PS remoting enabled.

When I run this command:

# this takes about 20-30 seconds to complete

Invoke-Command-ScriptBlock{get-date}-ComputerName(gc100servers.txt)

# this takes at least 90 seconds to complete when I set throttle to 100

Invoke-Command-ScriptBlock{get-date}-ComputerName(gc100servers.txt)-ThrottleLimit100

I didn't get these delays when my local was running powershell 2 and executing against the same set of servers with PS4 on them.  PS2 only took 2-3 seconds to finish the command if all were online.  If I run the command in PS4 ISE, it seems to work fast as well but for some reason PS4 traditional shell (not ISE) gives me these delays when working with large set of servers and increasing throttle to 100+

Sometimes you get different results if you keep running it with the same shell, but if you open a new shell with -noprofile switch then I get the same execution delays with PS4.

# I even tried skipping the different checks with sessionOption below but same results

Invoke-Command-ScriptBlock{get-date}-ComputerName(gc100servers.txt)-ThrottleLimit100-SessionOption(New-PSSessionOption-SkipCACheck-SkipRevocationCheck-SkipCNCheck)

I also tried running the same command from win8.1 with PS4 and it will hang for about 90 seconds before it spits out all the results at once.

This seems to be a problem with large number of servers of at least 50.  Works fine with small set.  Is anyone else having this problem?  I know there's other ways of running scripts in parallel, but I can't figure out why this is not working.  I'm also using the default pssessionoption below.  I have full admin rights to all the servers.  Any suggestions?

MaximumConnectionRedirectionCount : 5
NoCompression                     : False
NoMachineProfile                  : False
ProxyAccessType                   : None
ProxyAuthentication               : Negotiate
ProxyCredential                   :
SkipCACheck                       : False
SkipCNCheck                       : False
SkipRevocationCheck               : False
OperationTimeout                  : 00:03:00
NoEncryption                      : False
UseUTF16                          : False
IncludePortInSPN                  : False
OutputBufferingMode               : None
Culture                           :
UICulture                         :
MaximumReceivedDataSizePerCommand :
MaximumReceivedObjectSize         :
ApplicationArguments              :
OpenTimeout                       : 00:03:00
CancelTimeout                     : 00:01:00
IdleTimeout                       : -00:00:00.0010000



Remove BUILTIN\Administrators BUILTIN\Users NTFS Security

$
0
0

Hi to all. I would like to remove BUILTIN\Administrators and BUILTIN\Users from the 'Security' tab on NTFS folder. I have removed inheritance and have then tried the following:

[code]

Remove-NTFSAccess "E:\FolderA\FolderB\" -Account 'BUILTIN\Users' -AccessRights None,ReadData, ListDirectory, CreateFiles, CreateDirectories, AppendData,ReadExtendedAttributes, WriteExtendedAttributes, Traverse, ExecuteFile, DeleteSubdirectoriesAndFiles, ReadAttributes, WriteAttributes, Write, Delete, ReadPermissions,
Read, ReadAndExecute, Modify, ChangePermissions, TakeOwnership, Synchronize, FullControl

 [/code]

The above still lists BUILTIN\Users on the Security tab with special permissions (Create Files/write data + Create Folders / append data).

How might I remove BUILTIN\Users altogether?

Kind Regards

Phil.

Removing a permission from a registry key via powershell

$
0
0

Hello,

I am trying to remove local windows group permission from a registry key and replace it with a domain window group. I have already managed to add my domain group to the registry key but I'm struggling with the syntax to remove the local group.

I was following the Q&A from this technet forum question: Removing Registry Permission with PowerShell

But I have not been successful and receive the error: Method invocation failed because [System.Security.AccessControl.RegistrySecurity] doesn't contain a method named 'PurgeAccessRule'.

See code below:

$acl = get-acl "HKLM:\SOFTWARE\Wow6432Node\MyKey"
$SPLocalGroup = $env:COMPUTERNAME + "/LocalGroup"
$Acl.PurgeAccessRule([System.Security.Principal.NTAccount] $SPLocalGroup)
$acl |Set-Acl -Path "HKLM:\SOFTWARE\Wow6432Node\MyKey"
Thanks in advance.

Add Cross Forest user to AD Group using [ADSI] or System.DirectoryServices.DirectoryEntry

$
0
0

Hi,

I need to add cross forest users to a domain group in AD using powershell, however I do not have access to Server 2008 ActiveDirectory powershell module. Does anyone have an idea how to do this via the [ADSI] type accelerator or the System.DirectoryServices.DirectoryEntry .Net Type?

Regards,

Michael.

Compare-Object giving me unexpected results

$
0
0

Hello,

Im having trouble to find a bug in my code. I want to see daily changes how computers are created / deleted in our AD.

Looks like, if I create small CSV with few computers, I get what I want.

When I create CSV with 4k+ entries, the result is somehow bugged.

There is my code

     $before = Import-csv 'D:\SCRIPTS\PS1\Testing\CSV\before.csv'
     $after =  Import-Csv 'D:\SCRIPTS\PS1\Testing\CSV\after.csv'

## All changes
    $compare = Compare-Object -ReferenceObject $after -DifferenceObject $before -Property OUPath -PassThru -IncludeEqual
    $result = $compare |
              select name,OUPath,@{n="SideIndicator";e={switch($_.SideIndicator){"<="{"IN"}"=>"{"OUT"}"=="{"=="}}}}|
              ?{$_.SideIndicator -ne "=="}
              $body += "<b><font color=darkblue>All changes </font><b><br>"
    $body += ($result |ConvertTo-Html)

## New computers
    $new = $result |group name |?{$_.count -eq "1"} |select -ExpandProperty group |?{$_.Sideindicator -eq "IN"}
    $body += "<br>"
    $body += "<b><font color=green>New computers </font><b><br>"
    $body += ($new |ConvertTo-Html)

## Deleted computers
    $removed = $result |group name |?{$_.count -eq "1"} |select -ExpandProperty group |?{$_.Sideindicator -eq "OUT"}
    $body += "<br>"
    $body += "<b><font color=red>Removed computers </font><b><br>"
    $body += ($removed |ConvertTo-Html)

## OU Changes
    $Oumoves = $($differences = $result |group name |?{$_.count -gt "1"}
                foreach ($list in $differences){
                $list|  select -ExpandProperty group })
    $body += "<br>"
    $body += "<b><font color=orange> OU changes </font><b><br>"
    $body += ($OUmoves |ConvertTo-Html)

Send-MailMessage @messageParameters -body $body -subject "Subject" -BodyAsHtml

and sample CSV $before + $after
$before
#TYPE Selected.Microsoft.ActiveDirectory.Management.ADComputer
"name","OUPath"
"N050A0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N051A0001","OU=L4,OU=PCs,DC=contoso,DC=com"
"N051A0002","OU=L3,OU=PCs,DC=contoso,DC=com"
"N051A0003","OU=L3,OU=PCs,DC=contoso,DC=com"
"N052A0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N052A0002","OU=L3,OU=PCs,DC=contoso,DC=com"
"N052A0003","OU=L3,OU=PCs,DC=contoso,DC=com"
"n053a0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N053A0003","OU=L3,OU=PCs,DC=contoso,DC=com"
"N053A0004","OU=L3,OU=PCs,DC=contoso,DC=com"
"N053A0005","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0002","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0003","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0004","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0005","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0006","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0007","OU=L3,OU=PCs,DC=contoso,DC=com"
"N057A0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N057A0002","OU=L3,OU=PCs,DC=contoso,DC=com"
"N057A0003","OU=L3,OU=PCs,DC=contoso,DC=com"

$after
#TYPE Selected.Microsoft.ActiveDirectory.Management.ADComputer
"name","OUPath"
"N050A0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N051A0001","OU=L4,OU=PCs,DC=contoso,DC=com"
"N051A0002","OU=L3,OU=PCs,DC=contoso,DC=com"
"N051A0003","OU=L3,OU=PCs,DC=contoso,DC=com"
"N052A0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N052A0002","OU=L3,OU=PCs,DC=contoso,DC=com"
"N052A0003","OU=L3,OU=PCs,DC=contoso,DC=com"
"n053a0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N053A0003","OU=L3,OU=PCs,DC=contoso,DC=com"
"N053A0004","OU=L3,OU=PCs,DC=contoso,DC=com"
"N053A0005","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0001","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0002","OU=L5,OU=PCs,DC=contoso,DC=com"
"N054A0003","OU=L0,OU=PCs,DC=contoso,DC=com"
"N054A0004","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0005","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0006","OU=L3,OU=PCs,DC=contoso,DC=com"
"N054A0007","OU=L3,OU=PCs,DC=contoso,DC=com"
"N055A0001","OU=L4,OU=PCs,DC=contoso,DC=com"

So far so good.

Problem is, when the CSV contain large number of entries (4500+).
Identical CSV files (just containing more computers) and I made the same changes in after.csv (added n055, removed n057 ..)

The output now is NONSENSE

 

Any ideas?


How to move AD user accounts to a specified OU from CSV file

$
0
0

Hi all

I currently have a CSV file with one column of listed saMAccount names, though I need to search these accounts in Active directory and move them to a specified OU called "Terminal Services Accounts"
They all have one thing in common; their username / saMAccount names are firstname.lastname (logon name)

If there is a script to utilise the CSV file, search these AD accounts and move them to the OU called "Terminal Services Accounts".

They can either be enabled or disabled accounts.

Thanks

Jon

Install AdcsCertificationAuthority

$
0
0

Hi,

Can someone please help me out with the following command? I'm looking for hours now, but i can not solve it.. Yes, I am a beginner:)

Install-AdcsCertificationAuthority -CAType EnterpriseSubordinateCA -CACommonName "IssuingCA-CA2" -KeyLength 2048 -HashAlgorithm SHA1 -CryptoProviderName "RSA#Microsoft Software Key Storage Provider"

I am getting the following error:

Install-AdcsCertificationAuthority : Active Directory Certificate Services setup failed with the following error:  A
value for the attribute was not in the acceptable range of values. 0x80072082 (WIN32: 8322)
At line:1 char:1
+ Install-AdcsCertificationAuthority -CAType EnterpriseSubordinateCA -CACommonName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-AdcsCertificationAuthority], CertificationAuthoritySetupEx
   ception
    + FullyQualifiedErrorId : SetCAProperties,Microsoft.CertificateServices.Deployment.Commands.CA.InstallADCSCertific
   ationAuthority

Thanks in advance,

Nick




Get-WMIObject from within script run via PowerShell Remoting

$
0
0
I have a script that sits on a server in another location (ScriptingHost). The server is geographically more ideal for running scripts against remote hosts than my desktop's location. The ScriptingHost server is running '12core. The script I am trying to run attempts to collect data via Get-WMIObject. When I Enter-PSSession to the ScriptingHost server and then try to run the script I get  'Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))'. If I RDP to the ScriptingHost server, launch PowerShell and run the script it works fine. I have tried defining a credential and passing it to the -Credential parameter of Get-WMIObject with no success. I figured whatever creds I'm using with Enter-PSSession would be used to run the script (i.e. Get-WMIObject). Thoughts?

Exporting Mailbox Statistics for reporting

$
0
0

Hello,

I'm working on a script based on specific criteria.  The export is including the total item size in bytes...we do not want this, I'm at a loss as to how to only get the data in GB.  I'm sure there is a better way that what I have here, if so...I'm open to suggestions.

Here is my script:

#Variable for imported user
$users = Import-Csv C:\users.csv

# This creates an Empty Array
$usermailboxes = @()

# This is for user mailboxes
foreach ($user in $users)
{
$eachuser = Get-MailboxStatistics -Identity $user.users
$archivedUser = Get-MailboxStatistics -Archive $user.users
$Mailboxinfo = New-Object PSObject
$ArchiveMailboxinfo = New-Object PSObject

$Mailboxinfo | Add-Member NoteProperty -Name "Display Name" -Value $eachuser.DisplayName
$Mailboxinfo | Add-Member NoteProperty -Name "EMail Count" -Value $eachuser.ItemCount
$Mailboxinfo | Add-Member NoteProperty -Name "Mailbox Size" -Value $eachuser.TotalItemSize
$Mailboxinfo | Add-Member NoteProperty -Name "Has EMail Archive" -Value $archivedUser.ItemCount
$Mailboxinfo | Add-Member NoteProperty -Name "Archive Size" -Value $archivedUser.TotalItemSize
$Mailboxinfo | Add-Member NoteProperty -Name "Deleted EMail Count" -Value $eachuser.DeletedItemCount
$Mailboxinfo | Add-Member NoteProperty -Name "Deleted EMail Size" -Value $eachuser.TotalDeletedItemSize
$usermailboxes +=$Mailboxinfo
}

# This is the export of the combined foreach loops
$usermailboxes | Export-Csv "C:\Reports\test_export.csv" -NoTypeInformation

Thanks,

Rickey

Add-PrinterDriver -InfPath

$
0
0

Hello,

I am working on managing new windows 8.1 machines with some powershell scripts. I have figured out how to add a printer, assuming that the driver already exists on the machine. However, I cannot seem to add a printer driver.

The line I believe should work looks like this:

Add-PrinterDriver -Name "Canon iR-ADV C5045/5051 PS3" -InfPath "C:\Scratch\CanonPrintDriver\"

However, I receive the following:

Add-PrinterDriver : One or more specified parameters for this operation has an invalid value.
At line:1 char:1
+ Add-PrinterDriver -Name "Canon iR-ADV C5045/5051 PS3" -InfPath "C:\Scratch\Canon ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (MSFT_PrinterDriver:ROOT/StandardCimv2/MSFT_PrinterDriver) [Add-Printer
   Driver], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070057,Add-PrinterDriver

If I remove the -infpath option, it fails, saying the driver does not exist in the driver store, so I know that the issue must be with the syntax of -infpath. However, I am unable to find any resources online that show me an example of the -infpath parameter correctly used. Any ideas?

Thanks

Read a text file from the bottom up

Powershell Find RSAT and install if not installed

$
0
0

Creating a UI for password resets and account unlock tool for supervisors to use (after delegating permissions)

I found one that someone created and modified it quite a bit (cleaned it up, added in some email notification of tool use for security) and it seems to be working well.  The tool has a prerequisite of RSAT on the computer.  I would like to build this into the tool to query and install if not installed. This would be easy with windows server 2012 or windows 8 as they have the new command add-feature etc.

I can not seem to find this for windows 7 though.

Anyone have any ideas of how to query rsat on windows 7, and install if not installed - via powershell

Thanks

John

Format-list does not "line up" results

$
0
0

I have a strange issue and, after looking at many sites giving powershell how to and scripting guides I still cannot work out what I have done wrong.

I run a script that looks for details of specific ADUser objects, the information I want to pull includes sAMAccountName, name, mail, enabled, whenchanged and a couple of custom attributes. The reults display and, even though I use Format-list it still gives this output

rather than looking like this

Why, when I'm using format-list, does it not align the results?

Powershell can't find modules that worked before

$
0
0
  • Hi All, I am hoping someone can provide a simple solution to my question. For starters, here is what I am working with:

    OS: Windows Server 2012 R2 setup in an RDS farm configuration

    Powershell Info:

    Name                           Value                                                                                  
    ----                           -----                                                                                  
    PSVersion                      4.0                                                                                    
    WSManStackVersion              3.0                                                                                    
    SerializationVersion           1.1.0.1                                                                                
    CLRVersion                     4.0.30319.34209                                                                        
    BuildVersion                   6.3.9600.17400                                                                         
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}                                                                   
    PSRemotingProtocolVersion      2.2       

    About a week ago I was able to launch powershell, type import-module remotedesktop and press enter so that I could perform various RDS functions in Powershell that cannot be done through the Windows GUI.

    Now when I attempt to do so, I get the following:

    import-module : Could not load file or assembly 'Microsoft.RemoteDesktopServices.Management.Activities,
    Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find
    the file specified.
    At line:1 char:1
    + import-module remotedesktop
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Import-Module], FileNotFoundException
        + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

    When I look under C:\Windows\System32\WindowsPowerShell\v1.0\Modules I can see a folder for RemoteDesktop and it contains Powershell scriptmodules. No windows updates were applied to the server and the event logs are clean as a whistle.

    My question is simple, what did I do wrong?


Using Foreach within a pipeline

$
0
0

I am working on a Azure Dev/Test script where I am pulling in all my environment configurations via XML configuration file.  The file lists all the VM's that I need to create, the VM details and the associated disks that I need to attach.  Here is the structure of the XML that I am working with.

<VirtualMachine><Role>Web Server</Role><VMName>SCWEB01</VMName><InstanceName>SCWEB01</InstanceName><ScaledSize>A3</ScaledSize><ProdSize>D14</ProdSize><Disks><Disk><DiskLabel>Data</DiskLabel><DiskSize>500</DiskSize><LunNum>0</LunNum></Disk><Disk><DiskLabel>Logs</DiskLabel><DiskSize>500</DiskSize><LunNum>1</LunNum></Disk><Disk><DiskLabel>Stuff</DiskLabel><DiskSize>500</DiskSize><LunNum>2</LunNum></Disk></Disks></VirtualMachine>

What I am doing is looping thru each of the Virtual Machines and I am able to know that one VM has 3 disks and another VM has only two disks.  The problem is when I go and create the VM using New-AzureVMConfig, the VM creation and addition additions are all may thru pipelines.  

Here is the funciton that I created:

function Import-AzureDevTestVMList { [CmdletBinding(SupportsShouldProcess=$False,SupportsTransactions=$False,ConfirmImpact="None",DefaultParameterSetName="")] param([Parameter(Mandatory = $true)] [xml] $AzureConfigFile, [Parameter(Mandatory = $false)] [string] $CSVFileLocation) write-host "Number of Virtual Machines: " $AzureConfigFile.NetworkConfiguration.VirtualMachines.VirtualMachine.Count $NumberVmsIndex = $AzureConfigFile.NetworkConfiguration.VirtualMachines.VirtualMachine.Count $W2K8R2SP1image = Get-AzureVMImage | where { $_.ImageFamily -eq "Windows Server 2008 R2 SP1" } | Sort-Object -Descending -Property PublishedDate $W2012R2images = Get-AzureVMImage | where { $_.ImageFamily -eq "Windows Server 2012 R2 Datacenter" } | Sort-Object -Descending -Property PublishedDate $vmIndex = 0 FOREACH ($virtualMachine in $AzureConfigFile.NetworkConfiguration.VirtualMachines.VirtualMachine) { $domainjoin = $virtualMachine.Domain.DC1 + "." + $virtualMachine.Domain.DC2 $disks = $virtualMachine.Disks.Disk $diskCount = 0 $diskCount = $AzureConfigFile.NetworkConfiguration.VirtualMachines.VirtualMachine[$vmIndex].Disks.Disk.Count Write-Host "Current Index: " $vmIndex ":" $virtualMachine.VMName, $virtualMachine.Role, $virtualMachine.ImageName, "Disks: " $diskCount Foreach ($disk in $disks) { write-host "Found Disk: "$disk.DiskLabel,$disk.DiskSize,$disk.LunNum } if ($virtualMachine.ImageName -eq "Windows Server 2008 R2 SP1") { $vmconfigs = New-AzureVMConfig -Name $virtualMachine.VMName -InstanceSize $virtualMachine.InstanceName -ImageName $W2K8R2SP1image[0].ImageName | Add-AzureProvisioningConfig -WindowsDomain -JoinDomain $domainjoin -Domain $virtualMachine.Domain.OU -DomainUserName $virtualMachine.DomainUser -DomainPassword $virtualMachine.DomainPassword -AdminUsername $virtualMachine.LocalAdminUser -Password $virtualMachine.LocalAdminPassword |% ($disks) | Add-AzureDataDisk -CreateNew -DiskSizeInGB $disks.DiskSize -DiskLabel $disks.DiskLabel -LUN $disks.LunNum

} else { $vmconfigs = New-AzureVMConfig -Name $virtualMachine.VMName -InstanceSize $virtualMachine.InstanceName -ImageName $W2012R2images[0].ImageName | Add-AzureProvisioningConfig -WindowsDomain -JoinDomain $domainjoin -Domain $virtualMachine.Domain.OU -DomainUserName $virtualMachine.DomainUser -DomainPassword $virtualMachine.DomainPassword -AdminUsername $virtualMachine.LocalAdminUser -Password $virtualMachine.LocalAdminPassword #$vmconfigs | Select-Object = Add-AzureDataDisk -CreateNew -DiskSizeInGB $disk.DiskSize -DiskLabel $disk.DiskLabel -LUN $disk.LunNum } $vmIndex = $vmIndex + 1 } return $vmconfigs }

My question is how would you loop thru an object that as a variable number of sub elements.  I have tried various ways of doing a for-each within a pipelined for-each but none of them allow me to add the disks.
            $vmconfigs = New-AzureVMConfig -Name $virtualMachine.VMName -InstanceSize $virtualMachine.InstanceName -ImageName $W2K8R2SP1image[0].ImageName |
            Add-AzureProvisioningConfig -WindowsDomain -JoinDomain $domainjoin -Domain $virtualMachine.Domain.OU -DomainUserName $virtualMachine.DomainUser -DomainPassword $virtualMachine.DomainPassword -AdminUsername $virtualMachine.LocalAdminUser -Password $virtualMachine.LocalAdminPassword |% ($disks) | Add-AzureDataDisk -CreateNew -DiskSizeInGB $disks.DiskSize -DiskLabel $disks.DiskLabel -LUN $disks.LunNum 
If anyone has any guidance on this, I would greatly appreciate it.


how to list property or method of other property

$
0
0

hello

in my example invoke-expression 'arp -a' | select-string -pattern "10.10.10.[2-9]\b|10.10.10.[1-9][0-9][^255]"| % {$_.line.split()}

when i used invoke-expression 'arp -a' | select-string -pattern "10.10.10.[2-9]\b|10.10.10.[1-9][0-9][^255]"| get-member

iI see only line as property but how to see if there is a sub property or sub method like $_.line.split()

thank you

Find file by file name containing a string?

$
0
0

Hi Guys,

I'm trying to write a function that looks for a txt file containing a string in it's name. 

$scriptLoc = [string](Get-Location)

$files = Get-ChildItem - Path $scriptLoc -filter *Yellow


So I have a list of files. 

Yellow_Config.txt

Blue_Config.txt

Red_Config.txt

What I want to do is only retrieve the .txt that contains the name Yellow. When I run my code nothing happens.

Service acccount permission to remote powershell to dns server on windows server 2012

$
0
0

Our Remote Management server with Windows Server 2012, needs to read and write toDNS on Windows Server 2012(with DNS & AD Roles) using PowerShell.

Our Remote Management server runs PowerShell only under specific Service Account.

What permissions does this Service Account need to read and modify DNS on Windows Server 2012 using the DnsServer PowerShell Module.

- Service Account is already part of DnsAdmins Group.

- What else and where ?

- Is there Server 2012 article on remote management of DNS with PowerShell ?

Thanks in advance

* The Remote Management server is setup correctly I can run all DNSServer cmdlts under a privileged account(Domain Admin).

     *I just need to understand where to set the permissions for remote PowerShell management for DNSServer

Rename Multtiple files and moved to folder

$
0
0

Hi guys, there is any PowerShell command by which we can rename multiple files ,moved to folder & set run schedule every hour.

  

Best Regards, Hussain

Viewing all 21975 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>