New answers tagged

0

I know this is an old post, but this is a quicker way: $Domain = 'sometrusteddomain.com' $NetbiosName = (get-adtrust -filter {Name -eq $Domain} -Properties FlatName).FlatName


0

You need to specify a base DN. This is typically the domain root DN.


2

There is no need to bother with an actual LDAP search since the Active Directory PowerShell module has been introduced in Windows Server 2008 R2. Get-ADGroupMember is what you are looking for. The AD PowerShell module is automatically installed on all Domain Controllers, but you can install it on any Windows Server system by enabling the corresponding ...


0

This was due to the following security setting be applied to the account used for Certificate Authentication. "Deny access to this computer from the network"


0

I've worked it out - I converted string into [datetime] and then use it as a filter $string='13/10/2021' $string=[Datetime]::ParseExact($string, 'dd/MM/yyyy', $null) Get-ChildItem -Recurse Cert:\localMachine\My | Where { $_.NotBefore -lt $string } | Remove-Item


0

Same method as the accepted answer, but without the need for PowerShell dism /Mount-Image /ImageFile:C:\Backup.vhdx /Index:1 /MountDir:C:\Mount dism /Capture-Image /ImageFile:C:\Backup.wim /CaptureDir:C:\Mount /Name:Backup Dism /Unmount-Image /MountDir:C:\Mount /Discard


0

For anyone who may encounter this in the future: I have more than one process running in the container (I know, this is not ideal, but in this case unavoidable), and the problem in my case was environment variables not being available to the processes invoked by the scheduled tasks. When environment variables are created as part of a Docker build, any env ...


0

Since you want to change the Compatible Node after the Outlook Node, I implemented to check for it to be the previous value using the PreviousSibling Method before changing value to True. Updated code: $docs = [xml](Get-Content ./test.xml) $doc = $docs.SelectNodes('/default/compatible') foreach ($d in $doc){ if($d.PreviousSibling.OuterXml -eq "&...


0

So, we must URL encode paramters like below : Add-Type -AssemblyName System.Web $WebURL = [System.Web.HttpUtility]::UrlEncode("https://plop.sharepoint.com") $SiteID = [System.Web.HttpUtility]::UrlEncode("{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") $WebID = [System.Web.HttpUtility]::UrlEncode("{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}") $...


0

Did you run group policy update command back then? in elevated cmd you run gpupdate maybe you didn't and after 4-5 the group policy updates you did synced that is why it worked.


0

This is a working version (for me at least) $isoImg = "C:\OrdinaDBA\ISO\en_sql_server_2019_developer_x64_dvd_baea4195.iso" $driveLetter = "X:\" # note the added ending backslash: mount fails if its not there :( #Check if elevated [Security.Principal.WindowsPrincipal]$user = [Security.Principal.WindowsIdentity]::...


0

Ok, so the answer to my question was that I had to pass the credentials explicitly by using the Credential parameter AND create a new PSSession with the same command. This is because PowerShell has too much attitude. Invoke-Command -Session (NewPSSession WIN-9F8JQL85GIA -Credential AD\Administrator) -ScriptBlock {Get-EventLog -LogName Security -Newest 100} ...


2

I'm guessing you want to get the newest 100 security event logs from the named computer. To do that, you just missed some braces: Invoke-Command { Get-EventLog –LogName Security –Newest 100} -ComputerName WIN-9F8JQL0989 The braces denote the scriptblock/payload that you want to execute (the command). The error you were getting was because you had mixed the ...


0

I would try this: Install-Module -Name SqlServer -Scope CurrentUser source: https://docs.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershell-7.1 If it works with your current login, then talk to someone about getting permission to update the local machine module folder.


0

The issue is caused by the format of your username. 'Access is denied' will occur when using the UPN format: username@domain.com Instead, connect to the server with the SamAccountName format: DOMAIN\username


2

You can use PowerShell remoting to connect to a VM and run PowerShell commands on that VM. However, if you want to do this from Azure Automation runbooks then you would need to create a Hybrid Worker VM in the same network as your VM's to run these tasks on. PowerShell remoting uses WINRM to talk to the VM, and you don't want to expose this to the internet ...


0

Once you have your list of devices, including the Guid, You can run this to delete all the devices in that .csv file. Import-CSV (your_path_and_file_name.csv) | foreach{Remove-MobileDevice -Identity $_.Guid}


0

quser This gives connected, disconnected, remote and local logins. Simple and easy. This also helps when you want to logoff sessions using the logoff # where # is the ID of the quser result


1

For the example command provided by the OP question: PS C:\Users\user> Get-Command gpg.exe CommandType Name Version Source ----------- ---- ------- ------ Application gpg.exe 2.2.28.... C:\Program Files ...


3

You're likely attempting to use the OS-native version of the module which is 1.0.0.0 and not as feature rich as the current version 1.1.0.0 which is available via PowerShell Gallery and is also bundled with Windows Server 2022. You can verify your version with the following command: Get-Module -List IISAdministration You can also verify the available ...


Top 50 recent answers are included