Tag Info

Hot answers tagged

6

This is because the -properties switch is not a formatting tool, it is intended as a way to receive more information than the default values already included. From the Get-ADOrganizationalUnit article. Specifies the properties of the output object to retrieve from the server. Use this parameter to retrieve properties that are not included in the default ...


5

You would need to use both, to specify which properties to retrieve from the DC, and which ones to select and ultimately display. -Properties * is a potential performance basher since the DSA will need to return every attribute that has a value, including certificates and other binary values you might not have need for In a script utilizing the AD cmdlets I ...


4

If you are running an Active Directory domain, the member computers will synchronize with the domain controllers. The domain controllers will synchronize with whichever Domain Controller holds the PDC emulator role. Thus there is no need to configure each machine. They are going to synchronize automatically using NTP.


4

Why are you remoting (invoke-command) to use a cmdlet which has a -computername parameter? Have you tried running the command directly?


4

See http://technet.microsoft.com/en-us/magazine/jj933287.aspx for an example of creating a VM and installing an OS from scratch. The steps are to create the vm, configure the vm, add the source ISO and a floppy with the unmattend.xml, then start the vm


3

Is there some reason why you aren't passing the -Active:$false switch to explicitly set the option to false? I haven't tested, but this certainly seems like it should force it to be off always.


3

Your problem, as found in one of those error messages is: If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Basically, you need to either set WinRM to use HTTPS (rather than ...


2

As a general rule it isn't the job of the hypervisor to install the os. Using your powershell to configure the vm you would then start your build process, which can also be scripted. Before I started using pxe boot MDT images I had unattended iso files I would mount. As soon as the system booted it ran the install self guided. I'm guessing something like ...


2

Yes. PowerShell can do a lot with Hyper-V virtual machines. Take your pick form the following CMDlets: Add-VMDvdDrive Add-VMFibreChannelHba Add-VMHardDiskDrive Add-VMMigrationNetwork Add-VMNetworkAdapter Add-VMNetworkAdapterAcl Add-VMNetworkAdapterExtendedAcl Add-VmNetworkAdapterRoutingDomainMapping Add-VMRemoteFx3dVideoAdapter Add-VMScsiController ...


2

You probably already have the answer, but for posterity, you may specify -SearchDumpsterOnly so it only returns deleted items: Search-Mailbox -SearchDumpsterOnly "user@domain.com" -TargetMailbox tmprecoveryemailacct@domain.com -TargetFolder inbox


2

From the inline comments of the Create-SBSMonitoringDb.ps1 that is used to recreate the DB in the referred guide: # In SBS 2011 std it requires Framework v4 Assemblies - Launch MoveDataPowerShellHost.exe as an admin from SBS BIN folder, then run this PS1 Indicating that the requirement to launch it from MoveDataPowerShellHost.exe is specific to SBS 2011. ...


2

What you need is a do { ... } while( ... ) loop: $env:COMPUTERNAME = Read-Host 'Please enter hostname' Do { $RepairReinstall = Read.Host ' 1: Repair Client 2: Re-install Client Answer' If (RepairReinstall -eq 1) { Write-Host " Repair Started" break } If (RepairReinstall -eq 2) { ...


2

Check the date and time on your VM and your local machine to make sure that everything is set correctly. If you've manually set the clock on either and they are not in sync, it can cause problems with the authentication.


2

Write a script with a never-ending loop like this: do { # check whatever you want to check and react to it... Start-Sleep -Seconds 30 } until ($false) Press CRTL+C to terminate


1

The question around how do I get PowerShell to use a specific type is quite simple, because you don't need to do anything if you can already provide the result of a command that provides the type you want by using NoteProperty. So in your example with $vmHost populated from the result of Get-VMHost you could do either of the following: $obj = new-object ...


1

It's using SQL Agent Job step tokens (explained here) to set the path to one thing for default instances and another thing for named instances. Then it's using the SQLSERVER provider to get a reference to a (policy?) object for the instance and call a method on it.


1

the time hierarchy in a windows forest so that all members sync time from the domain controllers. You should not set the members to sync time on their own as it could affect their ability to log on to the domain.


1

As suggested in the comments, having a scheduled powershell script run would be the best course of action. How you schedule is up to you, I would suggest some time late in the evening, so any changes you've made during the day will take place overnight. Now the script... I think it would be prudent to have the script pull all the users from the OU and ...


1

Your issue (as the errors state) is this line: $objRecord = New-Object PSObject -property $Record $Table += $objrecord You needed a new line between $Record and $Table: $objRecord = New-Object PSObject -property $Record $Table += $objrecord However, you can simplify and remove it. Here's my amended version of your script: Import-Module ...


1

You need to initialize $objRecord as an Array: $objRecord = @() Then you can += it. Also, you should just do: $objRecord += New-Object PSObject -property $Record $Table instead of: $objRecord = New-Object PSObject -property $Record $Table += $objrecord I.e.: you're doing 2 assignments. You either do a=a+1 or a+=1. I'd go with Steve's answer, ...


1

This should provide some guidance on how to put those PowerShell cmdlets together: http://technet.microsoft.com/en-us/library/jj613766.aspx.


1

Robocopy is a swiss army knife with MANY options. I think all other tools will suffer from the path too long error. Do you really need all the properties that Get-ChildItem produces in the CSV, or are you only interested in a list of fully qualified file names? If the latter, try this: ROBOCOPY source dest /IA:AO /FP /NP /S /L /LOG:myfiles.txt /L produces ...


1

OK, so luckily I wasn't in too much of a hurry to log into this machine, so over the past few weeks I've been thinking of other ways to get in. In case anyone else has this problem, here's a compiled list of ways I've thought of or found to regain access to a VM that is not responding: Reset password as per the links in my original question (if lost ...


1

The Convert*-SecureString cmdlets utilize the Windows Data Protection API to encrypt and decrypt strings. By default, the encryption key composed for this kind of operation is specific to the user account that made the call, and the machine which the call was made to. When you run sysprep /generalize, SysPrep (among other things) nukes the foundations of ...


1

Creating, configuring and managing VMs can easily be done via PowerShell, as other have mentioned. However, if you want more control on the VM lifecycle, such as creating/deploying templates and cloning disks, you should have a look at System Center Virtual Machine Manager; its operations are, of course, completely scriptable via PowerShell.


1

Simpler means using schtasks that shows in the UI, compatible in PowerShell 2. Designed for a standard build, may need to play about with $volumeinfo[x] when creating $taskrun to find the appropriate volume. $volumeinfo = GWMI -namespace root\cimv2 -class win32_volume $volumeid = $volumeinfo[1].deviceid $taskname = "ShadowCopyVolume" + ...


1

Here is a much better solution. This will put everything in a 3 column csv with group name, username, and sam account name. A lot easier to figure out what group someone is in when there's 400 users in a group as you don't have to scroll. Import-Module ActiveDirectory $Groups = (Get-AdGroup -filter * | Where {$_.name -like "**"} | select name ...


1

Late reply, but your problem is probably the default of 2012 to delay logon scripts. Try a lower setting at: Computer Configuration\Policies\Administrative Templates\System\Group Policy\Configure Logon Script Delay


1

Probably not the answer you were hoping for: When you use *-BitsTransfer cmdlets from within a process that runs in a noninteractive context, such as a Windows service, you may not be able to add files to BITS jobs, which can result in a suspended state. For the job to proceed, the identity that was used to create a transfer job must be logged on. For ...


1

You need to use the Persist flag. New-PSDrive Z -PsProvider FileSystem -Root \\10.40.1.1\export\isos -Persist



Only top voted, non community-wiki answers of a minimum length are eligible