We investigate maintenance and inventory policy for a k-out-of-n system in which the components' failures are hidden and follow a non-homogeneous Poisson process. Two types of inspections are performed to find failed components: planned periodic inspections and unplanned opportunistic inspections. The latter are performed at system failure times when n-k+1 components are down simultaneously. In all cases, the failed components are either minimally repaired or replaced with spare parts from the inventory. The inventory is replenished either periodically or when the system fails. The periodic orders have a random lead-time, but there is no lead-time for emergency orders, as these are placed at system failure times. The key objective is to develop a method to solve the joint maintenance and inventory problem for systems with considerable number of components, long planning horizon, and large inventory. We construct a simulation model to jointly optimize the periodic inspection interval, the periodic reorder interval, and periodic and emergency order-up-to levels. Because of the large search space, it is infeasible to try all possible combinations of decision variables in a reasonable amount of time. Thus, the simulation model is integrated with a heuristic search algorithm to obtain the optimal solution.